P13672 [CodeChef] abhstr
NOI
题目描述

Abhi and his friends (Shanky,Anku and Pandey) love to play with strings. Abhi invented a simple game. He will give a string S to his friends. Shanky and Anku will play the game while Pandey is just a spectator. Shanky will traverse the string from beginning (left to right) while Anku will traverse from last (right to left). Both have to find the first character they encounter during their traversal,that appears only once in the entire string. Winner will be one whose character is alphabetically more superior(has higher ASCII value). When it is not possible to decide the winner by comparing their characters, Pandey will be the winner.

Input
The first line of the input contains an integer T denoting the number of test cases. The description of T test cases follows.
Each test case contains a string S having only lowercase alphabets ( a..z ).

Output
For each test case, output a single line containing "SHANKY" if Shanky is the winner or "ANKU" if Anku is the winner or "PANDEY" if the winner is Pandey. Output your answer without quotes.

Constraints

1 ≤ T ≤ 100
1 < |S| ≤ 10^5

Example
Input:
3
google
breakraekb
aman

Output:
SHANKY
PANDEY
ANKU

Explanation
Example case 2. Both Shanky and Anku can not find any such character. Hence it is not possible to decide the winner between these two. So Pandey is the winner.

输入格式

见题面

输出格式

见题面

样例输入
3 google breakraekb aman
样例输出
SHANKY PANDEY ANKU