Towers
Time limit2sMemory limit1024 MB
Pick a subset of points for towers, with at most two towers per row or column, so every other point lies between two towers in its row or column.
Problem
Benson the Rabbit likes towers. There are cities numbered to , and city is located at the point with integer coordinates . No two cities are located at the same point. Benson wants to build towers in some of these cities so that the following conditions hold.
- For any , at most two towers have -coordinate equal to .
- For any , at most two towers have -coordinate equal to .
- Each of the cities either has a tower, or lies on the line segment between two towers with the same -coordinate or the same -coordinate. More formally, if city has no tower, then there are towers at and with , or towers at and with .
Input
The first line contains one integer , the number of cities.
The next lines are such that the -th line contains two integers and , meaning city is located at the point .
Output
Output one line containing a string of characters . is if Benson builds a tower in city , and otherwise. The towers built must satisfy all the conditions.
If there are several solutions, your program can output any one of them.
Constraints
- For all , either or .