import java.util.*; public class Main { static interface Operation{ public String toString(); public static boolean get(long bitset, int index){ return ((bitset>>index)&1L) != 0; } public static long set(long bitset, int index, boolean x){ if(x) return bitset | (1L << index); else return bitset & ~(1L << index); } public long applyAsLong(long a); } static class Update implements Operation{ int i; boolean x; public Update(int i, boolean x){ this.i = i; this.x = x; } public long applyAsLong(long a){ return Operation.set(a, i, x); } public String toString(){ return String.format("UPD %d %d", i, x?1:0); } } static class And implements Operation{ int i,j,k; public And(int i, int j, int k){ this.i = i; this.j = j; this.k = k; } public long applyAsLong(long a){ return Operation.set(a, i, Operation.get(a,j)&&Operation.get(a,k)); } public String toString(){ return String.format("AND %d %d %d", i,j,k); } } static class Xor implements Operation{ int i,j,k; public Xor(int i, int j, int k){ this.i = i; this.j = j; this.k = k; } public long applyAsLong(long a){ return Operation.set(a, i, Operation.get(a,j)^Operation.get(a,k)); } public String toString(){ return String.format("XOR %d %d %d", i,j,k); } } public static void main(String[] args) throws Exception{ final ContestScanner sc = new ContestScanner(); final ContestPrinter pr = new ContestPrinter(); final int N = sc.nextInt(); final int K = sc.nextInt(); final int T = sc.nextInt(); boolean[] a = new boolean[N+1]; List ans = new ArrayList<>(10000); for(int i=0; i=0; j--){ ans.add(new And(N, j, j+1)); ans.add(new Xor(j, j, j+1)); ans.add(new Update(j+1, true)); ans.add(new Xor(j, j, j+1)); ans.add(new Xor(N, N, j+1)); ans.add(new And(j, j, N)); ans.add(new Xor(j, j, j+1)); ans.add(new Xor(j+1, j+1, N)); } } ans.add(new Update(N, true)); ans.add(new And(N, N, K-1)); pr.println(ans.size()); for(Operation op: ans) pr.println(op); pr.close(); } } class ContestScanner { private final java.io.InputStream in; private final byte[] buffer = new byte[1024]; private int ptr = 0; private int buflen = 0; private static final long LONG_MAX_TENTHS = 922337203685477580L; private static final int LONG_MAX_LAST_DIGIT = 7; private static final int LONG_MIN_LAST_DIGIT = 8; public ContestScanner(java.io.InputStream in){ this.in = in; } public ContestScanner(){ this(System.in); } private boolean hasNextByte() { if (ptr < buflen) { return true; }else{ ptr = 0; try { buflen = in.read(buffer); } catch (java.io.IOException e) { e.printStackTrace(); } if (buflen <= 0) { return false; } } return true; } private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1; } private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126; } public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte(); } public String next() { if (!hasNext()) throw new java.util.NoSuchElementException(); StringBuilder sb = new StringBuilder(); int b = readByte(); while(isPrintableChar(b)) { sb.appendCodePoint(b); b = readByte(); } return sb.toString(); } public long nextLong() { if (!hasNext()) throw new java.util.NoSuchElementException(); long n = 0; boolean minus = false; int b = readByte(); if (b == '-') { minus = true; b = readByte(); } if (b < '0' || '9' < b) { throw new NumberFormatException(); } while (true) { if ('0' <= b && b <= '9') { int digit = b - '0'; if (n >= LONG_MAX_TENTHS) { if (n == LONG_MAX_TENTHS) { if (minus) { if (digit <= LONG_MIN_LAST_DIGIT) { n = -n * 10 - digit; b = readByte(); if (!isPrintableChar(b)) { return n; } else if (b < '0' || '9' < b) { throw new NumberFormatException( String.format("%d%s... is not number", n, Character.toString(b)) ); } } } else { if (digit <= LONG_MAX_LAST_DIGIT) { n = n * 10 + digit; b = readByte(); if (!isPrintableChar(b)) { return n; } else if (b < '0' || '9' < b) { throw new NumberFormatException( String.format("%d%s... is not number", n, Character.toString(b)) ); } } } } throw new ArithmeticException( String.format("%s%d%d... overflows long.", minus ? "-" : "", n, digit) ); } n = n * 10 + digit; }else if(b == -1 || !isPrintableChar(b)){ return minus ? -n : n; }else{ throw new NumberFormatException(); } b = readByte(); } } public int nextInt() { long nl = nextLong(); if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException(); return (int) nl; } public double nextDouble() { return Double.parseDouble(next()); } public long[] nextLongArray(int length){ long[] array = new long[length]; for(int i=0; i