h,n = map(int,input().split()) H = [int(input()) for _ in range(n-1)] H.append(h) H.sort(reverse=True) if H[0]==h: print('st') elif H[1]==h: print('nd') elif H[2]==h: print('rd') else: print('th')