#include <bits/stdc++.h>   using namespace std;   long long tree[4000005];   long long level[4000005];   long long num[1000005];   long long build(long long at, long long L, long long R) {     if (L == R) {       tree[at] = num[L];       level[at] = 1;       return num[L];     }     long long mid = (L + R) / 2, a, b, p;     a = build(at * 2, L, mid);     b = build(at * 2 + 1, mid + 1, R);     level[at] = p = level[at * 2] + 1;     if (p % 2)       tree[at] = a ^ b;     else       tree[at] = a | b;     return tree[at];   }   long long update(long long at, long long L, long long R, long long i,                    long long x) {     if (L == R) {       tree[at] = x;       return tree[at];     }     long long mid = (L + R) / 2, a, b;     if (L <= i && mid >= i)       a = update(at * 2, L, mid, i, x), b = tree[at * 2 + 1];     else       a = update(at * 2 + 1, mid + 1, R, i, x), b = tree[at * 2];     if (level[at] % 2)       tree[at] = a ^ b;     else       tree[at] = a | b;     return tree[at];   }   int main() {     long long n, m;     long long a, i, j;     long long x, y;     cin >> n >> m;     n = pow(2, n);     for (a = 1; a <= n; a++) cin >> num[a];     build(1, 1, n);     for (a = 0; a < m; a++) {       cin >> x >> y;       update(1, 1, n, x, y);       cout << tree[1] << endl;     }     return 0;   }   