#include <bits/stdc++.h>
using namespace std;
int a[(1 << 17) + 1];
int tree[4 * (1 << 17)];
void build(int nd, int s, int e, bool ex) {
  if (s == e) {
    tree[nd] = a[s];
    return;
  }
  int mid = (s + e) / 2;
  int left = 2 * nd;
  int right = 2 * nd + 1;
  build(left, s, mid, !ex);
  build(right, mid + 1, e, !ex);
  if (ex) {
    tree[nd] = tree[left] ^ tree[right];
  } else {
    tree[nd] = tree[left] | tree[right];
  }
}
void update(int nd, int s, int e, int p, int v, bool ex) {
  if (s == e && s == p) {
    tree[nd] = v;
    return;
  }
  if (e < p || s > p) return;
  int mid = (s + e) / 2;
  int left = 2 * nd;
  int right = 2 * nd + 1;
  update(left, s, mid, p, v, !ex);
  update(right, mid + 1, e, p, v, !ex);
  if (ex) {
    tree[nd] = tree[left] ^ tree[right];
  } else {
    tree[nd] = tree[left] | tree[right];
  }
}
int main() {
  int n, m, total;
  cin >> n >> m;
  total = (1 << n);
  for (int i = 1; i <= total; i++) {
    scanf("%d", a + i);
  }
  build(1, 1, total, !(n & 1));
  int p, v;
  while (m--) {
    scanf("%d %d", &p, &v);
    update(1, 1, total, p, v, !(n & 1));
    cout << tree[1] << endl;
  }
  return 0;
}
