#include <bits/stdc++.h>
using namespace std;
const int N_MAX = (1 << 17) + 1;
int n, m, a[N_MAX], v, tree[2 * N_MAX];
void build(int pos, int l, int r, bool isOrOperation) {
  if (l == r) {
    tree[pos] = a[l];
    return;
  }
  int lPos = 2 * pos + 1, rPos = 2 * pos + 2, mid = (l + r) / 2;
  build(lPos, l, mid, !isOrOperation);
  build(rPos, mid + 1, r, !isOrOperation);
  if (isOrOperation) {
    tree[pos] = tree[lPos] | tree[rPos];
  } else {
    tree[pos] = tree[lPos] ^ tree[rPos];
  }
}
void update(int pos, int l, int r, int p, bool isOrOperation, int val) {
  if (p < l || p > r) {
    return;
  }
  if (l == r) {
    tree[pos] = val;
    return;
  }
  int lPos = 2 * pos + 1, rPos = 2 * pos + 2, mid = (l + r) / 2;
  update(lPos, l, mid, p, !isOrOperation, val);
  update(rPos, mid + 1, r, p, !isOrOperation, val);
  if (isOrOperation) {
    tree[pos] = tree[lPos] | tree[rPos];
  } else {
    tree[pos] = tree[lPos] ^ tree[rPos];
  }
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 0; i < (1 << n); ++i) {
    scanf("%d", &a[i]);
  }
  build(0, 0, (1 << n) - 1, n % 2);
  int p, b;
  while (m--) {
    scanf("%d%d", &p, &b);
    --p;
    update(0, 0, (1 << n) - 1, p, n % 2, b);
    printf("%d\n", tree[0]);
  }
  return 0;
}
