#include <bits/stdc++.h>
int in() {
  int r = 0, c;
  for (c = getchar(); c <= 32; c = getchar())
    ;
  if (c == '-') return -in();
  for (; c > 32; r = (r << 1) + (r << 3) + c - '0', c = getchar())
    ;
  return r;
}
using namespace std;
long long n, tam;
long long ar[140000], t[700000];
void init(int b, int e, int node, int level) {
  if (b == e) {
    t[node] = ar[b];
    return;
  }
  int mid = (b + e) / 2, l = node * 2 + 1, r = l + 1;
  init(b, mid, l, level + 1);
  init(mid + 1, e, r, level + 1);
  if ((level % 2 + 2) % 2 != (n % 2 + 2) % 2) {
    t[node] = t[l] | t[r];
  } else
    t[node] = t[l] ^ t[r];
}
void update(int b, int e, int node, int pos, long long val, int level) {
  if (b == e) {
    t[node] = val;
    return;
  }
  int mid = (b + e) / 2, l = node * 2 + 1, r = l + 1;
  if (pos > mid)
    update(mid + 1, e, r, pos, val, level + 1);
  else
    update(b, mid, l, pos, val, level + 1);
  if ((level % 2 + 2) % 2 != (n % 2 + 2) % 2)
    t[node] = t[l] | t[r];
  else
    t[node] = t[l] ^ t[r];
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int q;
  cin >> n >> q;
  tam = 1;
  int m = n;
  while (m--) tam *= 2;
  for (int i = 0; i < tam; i++) {
    cin >> ar[i];
  }
  init(0, tam - 1, 0, 0);
  int a;
  long long b;
  for (int i = 0; i < q; i++) {
    cin >> a >> b;
    update(0, tam - 1, 0, a - 1, b, 0);
    cout << t[0] << '\n';
  }
  return 0;
}
