#include <bits/stdc++.h>
using namespace std;
template <class T>
T abs(T x) {
  return x > 0 ? x : -x;
}
int n, m;
int a[1 << 20];
int t[1 << 20];
void upd(int v, int val) {
  v += 1 << n;
  t[v] = val;
  v /= 2;
  bool cur = 0;
  while (v > 0) {
    if (cur == 0)
      t[v] = t[2 * v] | t[2 * v + 1];
    else
      t[v] = t[2 * v] ^ t[2 * v + 1];
    v /= 2;
    cur ^= 1;
  }
}
int main() {
  scanf("%d %d", &n, &m);
  for (int i = 0; i < 1 << n; ++i) scanf("%d", &a[i]);
  memset((t), (0), sizeof(t));
  bool cur = 1;
  for (int h = 1 << n; h > 0; h /= 2) {
    for (int v = h; v < 2 * h; ++v)
      if (h == 1 << n)
        t[v] = a[v - h];
      else
        t[v] = cur == 0 ? t[2 * v] | t[2 * v + 1] : t[2 * v] ^ t[2 * v + 1];
    cur ^= 1;
  }
  while (m--) {
    int p, b;
    scanf("%d %d", &p, &b);
    upd(p - 1, b);
    printf("%d\n", t[1]);
  }
  return 0;
}
