#include <bits/stdc++.h>
using namespace std;
int A[200000];
int tr[4 * 200000];
bool ask[4 * 200000];
int n = 1, m, w;
void build(int x, int a, int b) {
  if (a == b) {
    tr[x] = A[a];
    ask[x] = 1;
    return;
  }
  build(2 * x, a, (a + b) / 2);
  build(2 * x + 1, (a + b) / 2 + 1, b);
  if (!ask[2 * x]) {
    tr[x] = tr[2 * x] ^ tr[2 * x + 1];
    ask[x] = 1;
  } else {
    tr[x] = tr[2 * x] | tr[2 * x + 1];
    ask[x] = 0;
  }
}
int l = 1, r = n;
long long val, q;
void update(int x, int a, int b) {
  if (a > q || b < q) return;
  if (a == b && a == q) {
    tr[x] = val;
    x /= 2;
    while (x) {
      if (!ask[x])
        tr[x] = tr[2 * x] | tr[2 * x + 1];
      else
        tr[x] = tr[2 * x] ^ tr[2 * x + 1];
      x /= 2;
    }
    return;
  }
  update(2 * x, a, (a + b) / 2);
  update(2 * x + 1, (a + b) / 2 + 1, b);
}
int main() {
  cin >> w >> m;
  for (int i = 0; i < w; i++) n *= 2;
  for (int i = 1; i <= n; i++) scanf("%d", A + i);
  build(1, 1, n);
  for (int i = 0; i < m; i++) {
    cin >> q >> val;
    update(1, 1, n);
    printf("%d\n", tr[1]);
  }
  return 0;
}
