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.

```python

USER_FILENAME = "<user_code>"
import sys, json, builtins
import math, heapq, bisect, itertools, functools, collections, statistics, fractions, decimal, operator, array, random, re, string, os, pathlib
try:
    import resource as _res
except Exception:
    _res = None
from collections import Counter, defaultdict, deque, OrderedDict
from functools import lru_cache, reduce
from itertools import accumulate, permutations, combinations, product
from math import gcd, ceil, floor, sqrt
from decimal import Decimal
try:
    from typing import *
except Exception:
    pass
try:
    sys.setrecursionlimit(1_000_000)
except Exception:
    pass
try:
    import site as _site
    try:
        _sys_sites = _site.getsitepackages() if hasattr(_site, "getsitepackages") else []
        for _p in _sys_sites:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
    try:
        _usp = _site.getusersitepackages()
        if isinstance(_usp, str):
            _usp = [_usp]
        for _p in _usp:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
except Exception:
    pass

ns = {"__name__": "__main__"}
for _k, _v in list(globals().items()):
    if not _k.startswith("_"):
        ns[_k] = _v
_CODE = "t = int(input())\n\nfor e in range(t):\n\n str = input()\n\n dict = {}\n\n for x in range(len(str)):\n  if str[x] in dict:\n   dict[str[x]] = -1\n  else:\n   dict[str[x]] = x\n\n shankyIndex = len(str)\n ankuIndex = -1\n for x in dict:\n  if dict[x] != -1:\n   if dict[x] < shankyIndex:\n    shankyIndex = dict[x]\n   if dict[x] > ankuIndex:\n    ankuIndex = dict[x]\n\n ankuLetter = 0\n shankyLetter = 0\n\n if ankuIndex != -1:\n  ankuLetter = str[ankuIndex]\n else:\n  print('PANDEY')\n  continue\n\n if shankyIndex != len(str):\n  shankyLetter = str[shankyIndex]\n else:\n  print('PANDEY')\n  continue\n\n if shankyLetter > ankuLetter:\n  print('SHANKY')\n elif ankuLetter > shankyLetter:\n  print('ANKU')\n else:\n  print('PANDEY')"
_co = compile(_CODE, USER_FILENAME, "exec")
exec(_co, ns, ns)

```

Measured memory_bytes: 13293