J. Joy of playing TAPum
time limit per test
1.5 seconds
memory limit per test
1024 megabytes
input
standard input
output
standard output

Juana was given one of the most fun puzzle games ever created: TAPum!

The TAPum game starts with a string of $$$N$$$ characters. This string has the same number of 'T', 'A', and 'P' characters, and these are the only characters that appear.

In one move, you may choose three consecutive characters of the string that are pairwise different, and make them... TAPum! Making them TAPum means removing these three consecutive, pairwise different characters from the string. When characters are removed from the string, the remaining ones keep their relative order.

You win the TAPum game if, after zero or more moves, you manage to destroy all $$$N$$$ characters of the string, so that none remain.

Determine whether it is possible to win the game or not.

Input

A line with a string of $$$N$$$ characters ($$$3 \le N \le 999$$$).

All characters in the string are 'T', 'A', or 'P', and each of them appears the same number of times.

Output

A line with the character 'S' to indicate that it is possible to win the game, or 'N' to indicate that it is not possible.

Examples
Input
AAPTTAPPT
Output
S
Input
AAAPPPTTT
Output
N
Note

In the first example, the game can be won by making the following moves: AAPTTAPPT $$$\rightarrow$$$ AAPTPT $$$\rightarrow$$$ APT $$$\rightarrow$$$ empty string.

In the second example, no move can be made, so it is impossible to win.