Sonny uses a very peculiar pattern when he plays rock-paper-scissors. He keeps changing his moves so that an opponent can't beat him by copying his own strategy.
Sonny plays rock (R) in his first game, then paper (P) and scissors (S) in his second and third games. But what if someone uses the same strategy? To beat those opponents, in games 4 through 6 he plays the moves that beat rock, paper, and scissors — that is, paper, scissors, and rock, in that order. After that, to beat anyone copying that last set of moves (games 4 through 6), he plays scissors, rock, and paper in games 7 through 9. Now he is back to the original rock-paper-scissors order, but instead of predictably repeating the same moves, there is something better: he plays the moves that would beat anyone trying to copy his entire strategy from the very first game, and it continues like this. In symbolic form, Sonny's moves look like this:
R P S PSR SRP PSRSRPRPS SRPRPSPSR PSRSRPRPSSRPRPSPSRRPSPSRSRP ...
The spaces are only there to make Sonny's pattern easier to see; they do not change which move he plays in any given game.
Your job is to beat Sonny at his own game! If you know the number of the game you will play against Sonny, can you figure out which move you need to play in order to beat him?
Each line of the input contains a single integer N (1≤N≤1012), the number of the game you will play against Sonny. N=1 means Sonny's first game, N=7 means the 7th game, and so on. The input ends with a line containing N=0.
Note: N may be large enough to overflow a 32-bit integer, so be sure to use a larger data type (for example, long in Java or long long in C/C++).
For each test case, output on its own line the letter of the move you need to play to beat Sonny in that game.