Worn down by the feet of many visitors, the floor of the Grand Hall of the Athenaion is long overdue for replacement and you have been
placed in charge of executing its reconstruction. The hall floor is in the shape of a large
hexagon with side length S. However each tile is a slab of stone in the shape of
a rhombus having side lengths of 1 and internal angles of 60° and 120°.
These slabs must be placed to fill the entire hexagonal area.
We can observe that all rhombi can only end up in one of 3 orientations:
This piece is oriented straight Upwards, so we'll call this orientation U.
This piece looks tilted to the Right, so we'll call this orientation R.
This piece looks tilted to the Left, so we'll call this orientation L.
The placement of tiles has already been determined, and so you have been provided a list of coordinates corresponding to the centerpoint of each tile. However, the orientation of each tile has not been provided - you'll have to work these out on your own.
Each tile has a coordinate associated with it, but how do these actually get mapped
onto the hexagonal floor? The coordinate system we'll be using will have its
x-axis scaled down by a factor of tan(π / 6) = sqrt(3) / 3 ~= 0.577350).
When we place one vertex of our bounding hexagon at the origin point (0, 0) and
have it lie symmetric across the x-axis, then the centerpoints of every
possible tile position will have integer values for x and y. If you really want to
convert these given coordinates back into square cartesian coordinates, then simply
multiply every x value by tan(π / 6).
Input Data
First line will be S. The side length of the bounding hexagon on the floor.
3 * S^2 lines will then follow, each with two space-separated values (x, y)
corresponding to the centerpoints of tile on the lattice described above.
Answer
Should consist of 3 * S^2 space-separated characters, either U, R, or L,
corresponding to the orientation of each tile given.
The order of tiles in the input data should be preserved in the answer.
Example
Here is a small example:
input data:
1
6 0
3 -1
3 1
answer:
U L R
Here is the example that is pictured in the above prompt:
input data:
2
2 0
4 -2
5 1
5 3
7 -1
7 -3
8 2
11 3
11 1
11 -1
11 -3
14 0
answer:
U U L R L R U L R L R U
And here is a slightly larger example:
input data:
3
3 1
3 -1
5 3
5 -3
7 5
7 -5
6 0
8 2
9 -1
9 -3
11 -5
11 1
11 3
11 5
12 -2
14 -4
17 -5
17 -3
14 0
17 -1
20 -2
22 0
17 1
20 2
15 3
18 4
15 5
answer:
R L R L R L U U R L L R L R U U R L U R U U L U L U R
And another one:
input data:
3
2 0
7 5
5 3
5 1
7 -5
17 -5
17 5
22 0
5 -1
5 -3
14 -4
14 4
11 5
11 -5
19 3
16 2
19 1
19 -3
19 -1
16 -2
9 3
9 1
12 2
14 0
9 -3
12 -2
9 -1
answer:
U R R L L R L U R L U U R L L U R R L U R L U U L U R