H=int(input()) N=list(map(int,input().split())) print(N.index('H')) if H%10==1: print('st') elif H%10==2: print('nd') elif H%10==3: print('rd') else: print('th')