#include <bits/stdc++.h>
using namespace std;
int st[200005 * 3];
int v[200005];
int build(int p, int l, int r) {
  if (l == r) {
    st[p] = v[l];
    return 1;
  }
  int a = build(2 * p, l, (l + r) / 2);
  int b = build(2 * p + 1, (l + r) / 2 + 1, r);
  if (a % 2 == 0)
    st[p] = st[2 * p] ^ st[2 * p + 1];
  else
    st[p] = st[2 * p] | st[2 * p + 1];
  return a + 1;
}
int f(int p, int l, int r, int i, int v) {
  if (l == i && r == i) {
    st[p] = v;
    return 1;
  } else if (i < l || r < i)
    return 0;
  else {
    int a = f(2 * p, l, (l + r) / 2, i, v);
    int b = f(2 * p + 1, (l + r) / 2 + 1, r, i, v);
    int tem;
    if (a)
      tem = a;
    else
      tem = b;
    if (tem % 2 == 0)
      st[p] = st[2 * p] ^ st[2 * p + 1];
    else
      st[p] = st[2 * p] | st[2 * p + 1];
    return tem + 1;
  }
}
int main() {
  int n, m, a, b;
  cin >> n >> m;
  for (int i = 1; i <= pow(2, n); i++) cin >> v[i];
  build(1, 1, pow(2, n));
  for (int i = 0; i < m; i++) {
    cin >> a >> b;
    f(1, 1, pow(2, n), a, b);
    cout << st[1] << endl;
  }
  return 0;
}
