#include <bits/stdc++.h>
using namespace std;
inline void normal(long long &a) {
  a %= 1000000007;
  (a < 0) && (a += 1000000007);
}
inline long long modMul(long long a, long long b) {
  normal(a), normal(b);
  return (a * b) % 1000000007;
}
inline long long modAdd(long long a, long long b) {
  normal(a), normal(b);
  return (a + b) % 1000000007;
}
inline long long modSub(long long a, long long b) {
  normal(a), normal(b);
  a -= b;
  normal(a);
  return a;
}
inline long long modPow(long long b, long long p) {
  long long r = 1;
  while (p) {
    if (p & 1) r = modMul(r, b);
    b = modMul(b, b);
    p >>= 1;
  }
  return r;
}
inline long long modInverse(long long a) { return modPow(a, 1000000007 - 2); }
inline long long modDiv(long long a, long long b) {
  return modMul(a, modInverse(b));
}
long long arr[3 * 131072];
long long tree[6 * 131072];
void buildSegmentTree(long long node, long long l, long long r,
                      long long mode) {
  if (l == r) {
    tree[node] = arr[r];
    return;
  }
  long long left = (node * 2);
  long long right = (node * 2) + 1;
  long long mid = (l + r) / 2;
  buildSegmentTree(left, l, mid, mode ^ 1);
  buildSegmentTree(right, mid + 1, r, mode ^ 1);
  if (mode == 1) {
    tree[node] = tree[left] | tree[right];
  } else {
    tree[node] = tree[left] ^ tree[right];
  }
}
void update(long long node, long long l, long long r, long long index,
            long long newValue, long long mode) {
  if (l >= index and r <= index) {
    tree[node] = newValue;
    return;
  }
  long long left = node * 2;
  long long right = node * 2 + 1;
  long long mid = (l + r) / 2;
  if (index <= mid)
    update(left, l, mid, index, newValue, mode ^ 1);
  else if (index > mid)
    update(right, mid + 1, r, index, newValue, mode ^ 1);
  if (mode == 1) {
    tree[node] = tree[left] | tree[right];
  } else {
    tree[node] = tree[left] ^ tree[right];
  }
}
long long query(long long node, long long l, long long r, long long i,
                long long j) {
  return tree[1];
}
int main() {
  long long testCase = 1;
  long long T = testCase;
  while (testCase--) {
    long long n, m;
    cin >> n >> m;
    long long mode = n & 1;
    n = 1 << n;
    for (long long i = 1; i <= n; i++) cin >> arr[i];
    buildSegmentTree(1, 1, n, mode);
    while (m--) {
      long long p, b;
      cin >> p >> b;
      update(1, 1, n, p, b, mode);
      cout << query(1, 1, n, 1, n) << '\n';
    }
  }
  return 0;
}
