eolymp
bolt
Try our new interface for solving problems

Gangs

\includegraphics{https://static.e-olymp.com/content/d7/d76b909878ec8d5df75b6bd3e2a9cb5780ade2ba.jpg} The downtown core of Inner City is laid out as a grid, with numbered streets running north-south from \textbf{1}^st Street in the west to \textbf{20}^th Street in the east, and numbered avenues running east-west from \textbf{1}^st Avenue in the north to \textbf{20}^\{th \}Avenue in the south. The area is controlled by two gangs, the Blips and the Cruds. The boundary between their territory is the Green Line, running diagonally from the intersection of \textbf{1}^st Street and \textbf{1}^st Avenue to the intersection of \textbf{20}^th Street and \textbf{20}^th Avenue. The Blips control the area to the southwest of the Green Line, and the Cruds the area to the northeast. To prove their virility, the Blips go on "runs" through Crud territory, starting at \textbf{1}^st Avenue and \textbf{1}^st Street and ending at a point on the Green Line that varies from night to night. A run may return to the Green Line in between but never crosses it. A run uses avenues only in the east direction and streets only in the south direction. Thus a run can be described by a string of \textbf{E}'s and \textbf{S}'s of length \textbf{2n - 2}; such a run ends at \textbf{n}^th Street and \textbf{n}^th Avenue. The Blips judge the runs made on a given night (all of which have the same length) by how "\textbf{OG}" they are. A run \textbf{R_1} is more \textbf{OG} than a run \textbf{R_2} if and only if: \begin{itemize} \item \textbf{R_2} returns to the Green Line for the first time at an earlier point than when \textbf{R_1} returns to the Green Line, or \item \textbf{R_1} and \textbf{R_2} return to the Green Line at the same point, but the portion of \textbf{R_1} to that point (ignoring the initial \textbf{E }and final \textbf{S}) is more \textbf{OG} than the portion of \textbf{R_2} to that point (also ignoring the initial \textbf{E} and final \textbf{S}), or \item \textbf{R_1} and \textbf{R_2} return to the Green Line at the same point and are identical to that point, but the rest of \textbf{R_1} is more \textbf{OG} than the rest of \textbf{R_2}. \end{itemize} Examples corresponding to these three cases: \begin{itemize} \item \textbf{EESS} is more \textbf{OG} than \textbf{ESES}. \item \textbf{EEESSS} is more \textbf{OG} than \textbf{EESESS} \item \textbf{EESSEESS} is more \textbf{OG} than \textbf{EESSESES}. \end{itemize} If all the runs of a given length are ordered according to how \textbf{OG} they are, then the rank of a run is its position in the resulting list. \textbf{EESS} has rank \textbf{1} and \textbf{ESES} has rank \textbf{2}. Your task is to write a program to help the Blips plan and judge their nightly activities. \InputFile Contains a series of instances followed by \textbf{0 0}. An instance consists of a line containing a positive integer \textbf{n}, representing the terminus of that night's run (\textbf{n}^th Street and \textbf{n}^th Avenue), followed by positive integer \textbf{m}. \OutputFile Print the corresponding to each instance run of length \textbf{2n - 2} of rank \textbf{m}, or \textbf{ERROR} if there are fewer than \textbf{m }runs of length \textbf{2n - 2}.
Time limit 1 second
Memory limit 64 MiB
Input example #1
3 1
3 2
3 3
0 0
Output example #1
EESS
ESES
ERROR