There are obstacles placed in a field. Your task is to design a course that visits each obstacle exactly once, in any order, following a straight line between consecutive obstacles, without ever crossing itself.
The catch? The sequence of turn directions (left or right) has already been decided, in a string of length . If the
th character of the turn sequence is
L
, then the locations of the th,
th, and
th obstacles, in that order must form a counterclockwise angle. If it is
R
, they must form a clockwise angle.
Input
The first line of input contains a single integer
.
Each of the next lines contains two space-separated integers
and
, giving the coordinates of obstacle
.
The next and final line contains a single string with exactly characters consisting of only
L
and R
, representing the sequence of turn directions.
It is guaranteed that no three obstacles will be collinear.
Output
If no solution is possible, print, on a single line, the integer -1
. Otherwise, print, on a single line, any permutation of the obstacles that satisfies the requirements. The permutation should be given as distinct space-separated integers
with
, and this ordering of the points should satisfy the turn directions indicated by the turn sequence.
If there are multiple possible solutions, print any of them.
Sample Input
4
2 2
2 1
1 2
1 1
LR
Sample Output
1 3 2 4
Comments