import sys input = lambda : sys.stdin.readline().rstrip() write = lambda x: sys.stdout.write(x+"\n") debug = lambda x: sys.stderr.write(x+"\n") writef = lambda x: print("{:.12f}".format(x)) n,k = list(map(int, input().split())) t = int(input()) import random _a = [random.randint(0,1) for _ in range(n+1)] s = sum(_a[:n]) ans = [] def UPD(i, v): ans.append(("UPD", i, v)) _a[i] = v def AND(i, j, k): ans.append(("AND", i, j, k)) _a[k] = _a[i] and _a[j] def XOR(i, j, k): ans.append(("XOR", i, j, k)) _a[k] = _a[i]^_a[j] def swap(i,j): UPD(n,0) XOR(i,n,n) AND(i,j,i) XOR(j,n,n) XOR(i,n,j) for i in range(1,n): for j in range(i)[::-1]: swap(j,j+1) UPD(n,0) XOR(n-k,n,n) s2 = sum(_a[:n]) assert s==s2 print(len(ans)) write("\n".join([" ".join(map(str, item)) for item in ans]))