x = int(input()) if x == 1: print("1st") elif x == 2: print("2nd") elif x == 3: print("3rd") else: print(str(x) + "th")