405257: GYM101858 I Important Equipment

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

I. Important Equipmenttime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output

Humanity lives inside $$$3$$$ convex walls. The inner one is Wall Sheena, the second one is Wall Rose and the outer one is Wall Maria.

As a member of Survey Corps you are risk your life for humanity. The next mission is to gather some important equipment.

The Survey Corps have a list of $$$n$$$ equipment. You know the position of every equipment and you need to tell the Survey Corps where are each equipment, inside Wall Sheena, Wall Rose, Wall Maria or outside.

A position in the border of a wall is considered inside the wall.

Input

The first line of input contains three integers, $$$s$$$, $$$r$$$ and $$$m$$$ ($$$3 \le s, r, m \le 1000$$$) — the number of points that define Wall Sheena, Wall Rose and Wall Maria, respectively.

The next $$$s$$$ lines contains, each, two integers, $$$x_i$$$ and $$$y_i$$$ ($$$-10^6 \le x_i, y_i \le 10^6$$$) — the points that define Wall Sheena, in counter-clockwise order. No three points are collinear.

The next $$$r$$$ lines contains, each, two integers, $$$x_i$$$ and $$$y_i$$$ ($$$-10^6 \le x_i, y_i \le 10^6$$$) — the points that define Wall Rose, in counter-clockwise order. No three points are collinear.

The next $$$m$$$ lines contains, each, two integers, $$$x_i$$$ and $$$y_i$$$ ($$$-10^6 \le x_i, y_i \le 10^6$$$) — the points that define Wall Maria, in counter-clockwise order. No three points are collinear.

The next line contains one integer, $$$n$$$ ($$$1 \le n \le 1000$$$) — the number of important equipment.

The next $$$n$$$ lines contains, each, two integers, $$$x_i$$$ and $$$y_i$$$ ($$$-10^6 \le x_i, y_i \le 10^6$$$) — the position of $$$i$$$-th equipment.

It's guaranteed that all walls are convex, that Wall Sheena is strictly inside Wall Rose and that Wall Rose is strictly inside Wall Maria.

Output

For each equipment, print "Sheena", "Rose", "Maria" or "Outside", meaning that the equipment is inside the wall printed and not inside any inner one, or outside of all walls.

ExamplesInput
4 4 4
-1 -1
1 -1
1 1
-1 1
-2 -2
2 -2
2 2
-2 2
-3 -3
3 -3
3 3
-3 3
5
0 0
1 0
2 0
3 0
4 0
Output
Sheena
Sheena
Rose
Maria
Outside
Input
4 5 5
2 4
2 3
4 2
4 4
5 1
5 5
2 5
1 3
4 1
0 0
7 0
5 6
1 6
0 5
7
2 7
1 1
6 4
3 1
3 3
0 1
3 2
Output
Outside
Maria
Outside
Maria
Sheena
Maria
Rose
Note

Image on statement represents test case #2.

Source/Category

加入题单

算法标签: