#bzoj3340. Tram

Tram

Title Description

The seat is composed of N rows (numbered 1 to N) and 2 columns (numbered 1 and 2), two columns. For two seats with coordinates (xa, ya) and (xb, yb), their distance is defined as((XaXb)2+(YaYb)2)\sqrt{((Xa-Xb)^2+(Ya-Yb)^2)}. Most passengers prefer to be alone when using public transportation, and they always try to choose seats that are farther away from other passengers (the farther the better). More precisely, when a passenger enters the subway, he or she will try to choose the farthest seat from the person closest to them as much as possible. If there are multiple such seats, they will always choose the one with the smaller row number. If there are still more than one such seat, they will choose the seat with the smaller column number. If all the seats inside are empty, they will choose the first row and the first column. Write a program for a given sequence of events consisting of "E" and "L", where E represents entering the subway and L represents leaving the subway. Please confirm the seat of each passenger. At the beginning, the subway was empty.

Input format

Ensure that the input is legal.

Output format

Output based on the topic.