import sys def main(): # Precompute smallest prime factors (SPF) for numbers up to 1e5 MAX = 10**5 + 1 spf = list(range(MAX)) for i in range(2, int(MAX**0.5) + 1): if spf[i] == i: for j in range(i*i, MAX, i): if spf[j] == j: spf[j] = i # Read input input = sys.stdin.read().split() N = int(input[0]) A = list(map(int, input[1:N+1])) xor = 0 for a in A: if a == 1: xor ^= 1 continue # Factorize a factors = set() current = a while current != 1: p = spf[current] factors.add(p) while current % p == 0: current = current // p g = len(factors) xor ^= g if xor != 0: print("X") else: print("Y") if __name__ == "__main__": main()