import random n, K = map(int, input().split()) ans = [] #A = [random.randrange(2) for _ in range(n + 1)] #an = int(sum(A) >= K) def UPD(i, x): ans.append(f"UPD {i} {x}") #A[i] = x def AND(i, j, k): ans.append(f"AND {i} {j} {k}") #A[i] = A[j] & A[k] def XOR(i, j, k): ans.append(f"XOR {i} {j} {k}") #A[i] = A[j] ^ A[k] # sort 1111....0000 for i in range(n): for j in range(n - 1, 0, -1): XOR(n, j, j - 1) AND(j, j, j - 1) XOR(j - 1, j, n) UPD(n, 0) XOR(n, n, K - 1) print(len(ans)) print(*ans, sep="\n") #assert A[n] == an