University of Toronto ACM-ICPC Tryouts 2012

A: Rock Paper Scissors Fox

We're all familiar with the classic 2-player game of skill, Rock Paper Scissors. In each round, both players first choose one of the three objects. If both players choose the same one, it's a tie. Otherwise, if one player chooses Rock and the other chooses Scissors, the first player wins - similarly, Scissors beats Paper, and Paper beats Rock.

This game is pretty boring, though, so you're playing a variation with your friend - Rock Paper Scissors Fox. In addition to the above objects, a player may choose Fox - and, if the other player chooses one of the three basic objects, the first player wins. However, because this is so powerful, it should only be used when necessary. The only thing that can beat a Fox is, naturally, several of them - namely, Foxen. Nothing beats Foxen.

You're planning to play N (1 ≤ N ≤ 106) rounds of this game, and you conveniently know what object your opponent will choose in each one. You'd like to use this knowledge to beat him every time. If he chooses one of the three basic objects, you should pick the basic one that beats it. If he chooses Fox, you should choose Foxen. And if he chooses Foxen, you should of course walk away before that round occurs, and not play any rounds from then onwards.

Input

Line 1: 1 integer, N
Next N lines: Your opponent's choice in the i-th round (one of the strings "Rock", "Paper", "Scissors", "Fox", or "Foxen", without quotes), for i = 1..N

Output

X lines (where X is the number of rounds you play): Your choice in the ith round (in the same format as the input), for i = 1..N.

Sample Input

5
Scissors
Fox
Rock
Foxen
Paper

Sample Output

Rock
Foxen
Paper

Explanation of Sample

In the first round, your opponent chooses Scissors, so you should choose Rock to beat it. In the second, you beat his Fox with Foxen, and in the third, you choose Paper to beat Rock. You don't play any more rounds, because your opponent will choose Foxen in the fourth round, which can't be overcome.

All Submissions
Best Solutions


Point Value: 3
Time Limit: 10.00s
Memory Limit: 64M
Added: Oct 02, 2012
Author: SourSpinach

Languages Allowed:
C++03, PAS, C, HASK, ASM, RUBY, PYTH2, JAVA, PHP, SCM, CAML, PERL, C#, C++11, PYTH3

Comments (Search)

why dont i just tie foxen using foxen

The game is only fun if you can win!

also, was it your intention of getting 666 problems solved on christmas?

I realized I was in the neighbourhood of 666, so I figured I'd settle in :)

Why does it keep cutting off the Scissors every time I print Scissors?
is there something wrong with the judge?
WHY!? WHY!? WHY!?

Please read the rules for asking questions.