#include #include #include using namespace std; using namespace atcoder; using mint = modint998244353; #define rep(i,n) for (int i = 0; i < (n); ++i) #define Inf32 1000000001 #define Inf64 4000000000000000001LL int N,K; struct Data{ vector> pre,suf; int ans = Inf32; int sz = 0; }; Data op(Data a,Data b){ Data res; res.ans = min(a.ans,b.ans); res.sz = a.sz + b.sz; rep(i,a.suf.size()){ rep(j,b.pre.size()){ if(((a.suf[i].first | b.pre[j].first)==(1<>N>>K; vector a(N); rep(i,N){ int t; cin>>t; a[i] = make(t); } segtree seg(a); int _q; cin>>_q; rep(_,_q){ int t,x,y; cin>>t>>x>>y; if(t==1){ seg.set(x-1,make(y)); } else{ auto ret = seg.prod(x-1,y); if(ret.ans==Inf32)cout<<-1<