x = raw_input()
if x == "PERMUTATION":
	print("13 15 1 6 14 4 5 7 2 16 9 11 10 12 8 3")
else:
	a, b = map(int, raw_input().split(' '))
	if (a == 1):
		print(13)
	elif a == 2:
		print(15)
	elif a == 3:
		print(1)
	elif a == 4:
		print(6)
	elif a == 5:
		print(14)
	elif a == 6:
		print(4)
	elif a == 7:
		print(5)
	elif a == 8:
		print(7)
	elif a == 9:
		print(2)
	elif a == 10:
		print(16)
	elif a == 11:
		print(9)
	elif a == 12:
		print(11)
	elif a == 13:
		print(10)
	elif a == 14:
		print(12)
	elif a == 15:
		print(8)
	elif a == 16:
		print(3)