Problem A
Battle of Pokenom
In order to become the very best Pokenom trainer, Bash - the Pokenom trainer - must first understand the Pokenom battle rules.
A Pokenom battle between two Pokenom trainers
-
Step
: Pokenom attacks Pokenom . The attack can be effective or not effective. -
Step
: Pokenom attacks Pokenom . The attack can be effective or not effective.
If an attack is effective, the corresponding trainer will
receive exactly
Bash watched several Pokenom battles between trainers
After carefully reviewing the result, Bash noticed something
extraordinary: It is possible to know the outcome of the battle
before the last step! More formally, for each battle, there
exist a smallest step
For example, consider the following battle with
-
Round
: ‘E E’ -
Round
: ‘E N’ -
Round
: ‘E E’ -
Round
: ‘E E’ -
Round
: ‘E N’
After
Excited, Bash immediately tells his friend Cee
After that, Bash tells Cee the result of each step from
For example, in the above battle, Bash tells Cee
-
Round 1: ‘E E’
-
Round 2: ‘E N’
-
Round 3: ‘? ?’
-
Round 4: ‘? ?’
-
Round 5: ‘? ?’
Because Cee also knows that after
As Cee is very smart, he always tells Bash as soon as he can
infer the result of all step from
Given the result of all
Input
The first line of input contains exactly one positive
integer
-
The first line contains exactly one positive integer
. -
In the next
lines, the -th line contains space-separated characters, representing the result of the steps in the -th round.
Output
For each test case, print exactly one line containing
Sample Input 1 | Sample Output 1 |
---|---|
2 5 E E E N E E E E E N 3 N E N E E N |
9 4 4 0 |