from collections import Counter id, N, M = [int(s) for s in input().split()] C = [int(s) - 1 for s in input().split()] count = Counter(C) all_cnt = [0] * M ans = [0] * M def log(n, base): ans = 0 while n > 0: ans += 1 n //= base return ans def query(X): print("ASK", X) return get() def get(): _, X, K = input().split() return int(X), int(K) def answer(): result = [] for i in range(M): for _ in range(ans[i]): result.append(i + 1) print("GUESS", *result) def alice(): for i in range(M): if input() == "TURN": X, K = query(i + 1) else: X, K = get() all_cnt[X - 1] = K if M % 2 == 1: input() get() for i in range(M): times = log(i + 1, M) op = 0 for j in range(times): input() # TURN query(((C[i] // M**j) % M) + 1) input() # WAIT X, _ = get() op += (X - 1) * M**j ans[i] = op input() # TURN answer() input() # WAIT input() input() # END def bob(): for i in range(M): if input() == "TURN": X, K = query(i + 1) else: X, K = get() all_cnt[X - 1] = K if M % 2 == 1: input() query(1) for i in range(M): times = log(i + 1, M) op = 0 for j in range(times): input() # WAIT X, _ = get() input() # TURN query(((C[i] // M**j) % M) + 1) op += (X - 1) * M**j ans[i] = op input() # WAIT input() input() # TURN answer() input() # END if id == 1: alice() else: bob()