#include <bits/stdc++.h>
using namespace std;
const int mx = (1 << 18);
int A[mx], tr[4 * mx];
bool T[4 * mx];
int n;
void build(int x, int a, int b) {
  if (a == b) {
    tr[x] = A[a];
    T[x] = 1;
    return;
  }
  build(2 * x, a, (a + b) / 2);
  build(2 * x + 1, (a + b) / 2 + 1, b);
  if (T[2 * x] == 1) {
    tr[x] = tr[2 * x] | tr[2 * x + 1];
    T[x] = 0;
  } else {
    tr[x] = tr[2 * x] ^ tr[2 * x + 1];
    T[x] = 1;
  }
}
int l = 1, r = n;
int id, val;
void update(int x, int a, int b) {
  if (a > id || b < id) return;
  if (a == b && a == id) {
    tr[x] = val;
    x /= 2;
    while (x) {
      if (!T[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() {
  int q;
  scanf("%d%d", &n, &q);
  n = (1 << n);
  for (int i = 1; i <= n; i++) scanf("%d", A + i);
  build(1, 1, n);
  while (q--) {
    scanf("%d%d", &id, &val);
    update(1, 1, n);
    printf("%d\n", tr[1]);
  }
  return 0;
}
