#include using namespace std; using i64 = int_fast64_t; using pll = pair; #define fir first #define sec second #define mod 1000000007 void ios_untie() { ios::sync_with_stdio(false); cin.tie(0); } int n,m; int mt[334][334]; signed main() { ios_untie(); int X; cin>>n>>m>>X; for(int j=0; j<30; ++j,X>>=1) { mt[j][n]=X&1; } for(int i=0,a; i>a; for(int j=0; j<30; ++j,a>>=1) { mt[j][i]=a&1; } } for(int i=0; i>t>>l>>r; mt[i+30][n]=t; for(int j=l-1; j