Amagi Brilliant Contests runs a business making and hosting contests on its online platform to competitive programmers who want to run their own contests.
From their last contest, ABC has some submissions they need to rejudge to ensure an accurate score. The submissions each have their own status code. The four types of status codes that occurred during the contest were
When the submissions are rejudged, all of the existing
AC will stay
AC; the first (rounded down)
WA will turn to
AC and the rest will stay
WA; all existing
TLE will turn to
WA; and up to the first
IR will turn to
AC, up to the next will turn to
WA, and the rest will stay
You are the head of the technical troubleshooting department at Amagi Brilliant Contests, and so you have been tasked with determining the final list of status codes after rejudging (the initial list is given in order of rejudging).
The first line of input will have , the number of status codes.
The next lines of input will each contain a status code in the order that they are rejudged. A status code is guaranteed to be one of
There should be lines of output, each containing the new status code of the corresponding submission after rejudging, in the order they are rejudged.
Sample Input 1
4 AC AC TLE IR
Sample Output 1
AC AC WA AC
Explanation for Sample Output 1
The first two
ACs stayed the same, the
TLE turned to
WA, and the
IR turned to
Sample Input 2
21 IR IR IR WA IR WA IR IR IR IR WA IR IR WA IR WA IR IR IR WA IR
Sample Output 2
AC AC AC AC AC WA AC AC AC AC WA AC AC WA WA WA WA WA WA WA WA