#include #include #include using namespace atcoder; using mint = modint998244353; using namespace std; #define rep(i,n) for (int i = 0; i < (n); ++i) #define Inf 1000000001 int N,K,T; vector s; vector a,b,c; void UPD(int i,int x){ s.push_back("UPD "); a.push_back(i); b.push_back(x); c.push_back(-1); } void AND(int i,int j,int k){ s.push_back("AND "); a.push_back(i); b.push_back(j); c.push_back(k); } void XOR(int i,int j,int k){ s.push_back("XOR "); a.push_back(i); b.push_back(j); c.push_back(k); } bool sim(vector x){ x.push_back(0); rep(i,s.size()){ if(s[i][0]=='U'){ x[a[i]] = b[i]; } if(s[i][0]=='A'){ x[a[i]] = x[b[i]] & x[c[i]]; } if(s[i][0]=='X'){ x[a[i]] = x[b[i]] ^ x[c[i]]; } } return x.back(); } int main(){ cin>>N>>K>>T; vector> C(T,vector(N)); rep(i,T){ rep(j,N){ cin>>C[i][j]; } } rep(i,N){ if(i==0)continue; int r = i; int l = i-1; while(l>=0){ XOR(l,l,r); UPD(N,0); XOR(N,r,N); AND(r,l,r); XOR(r,r,N); XOR(l,l,r); l--; r--; } } UPD(N,0); XOR(N,N,K-1); /* rep(i,T){ cout<