#include <bits/stdc++.h>
using namespace std;
inline int re() {
  int x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = (x << 3) + (x << 1) + (ch ^ 48);
    ch = getchar();
  }
  return x * f;
}
long long tree[4 * ((1 << 17) + 5)];
long long a[(1 << 17) + 5];
void build(int l, int r, int tr, int ceng) {
  if (l == r) {
    tree[tr] = a[l];
    return;
  }
  int mid = (l + r) >> 1;
  build(l, mid, 2 * tr, ceng - 1);
  build(mid + 1, r, 2 * tr + 1, ceng - 1);
  if (ceng & 1)
    tree[tr] = tree[2 * tr] ^ tree[2 * tr + 1];
  else
    tree[tr] = tree[2 * tr] | tree[2 * tr + 1];
}
void upd(int l, int r, int tr, int pos, int z, int ceng) {
  if (l == r) {
    tree[tr] = z;
    return;
  }
  int mid = (l + r) >> 1;
  if (pos <= mid)
    upd(l, mid, 2 * tr, pos, z, ceng - 1);
  else
    upd(mid + 1, r, 2 * tr + 1, pos, z, ceng - 1);
  if (ceng & 1)
    tree[tr] = tree[2 * tr] ^ tree[2 * tr + 1];
  else
    tree[tr] = tree[2 * tr] | tree[2 * tr + 1];
}
int main() {
  int n, m;
  cin >> n >> m;
  for (int i = 1; i <= (1 << n); i++) a[i] = re();
  build(1, 1 << n, 1, n + 1);
  for (int i = 1; i <= m; i++) {
    int a = re(), b = re();
    upd(1, 1 << n, 1, a, b, n + 1);
    cout << tree[1] << endl;
  }
}
