#include <bits/stdc++.h>
using namespace std;
void build_segment(int s, int e, int *tree, int *a, int index) {
  if (s == e) {
    tree[index] = a[s];
    return;
  }
  int mid = (s + e) / 2;
  build_segment(s, mid, tree, a, 2 * index);
  build_segment(mid + 1, e, tree, a, 2 * index + 1);
  int n = log2(e - s + 1);
  if (n & 1) {
    tree[index] = tree[index * 2] | tree[index * 2 + 1];
  } else {
    tree[index] = tree[index * 2] ^ tree[index * 2 + 1];
  }
  return;
}
void update(int s, int e, int i, int dif, int index, int *tree) {
  if (i < s or i > e) {
    return;
  }
  if (s == e) {
    tree[index] = dif;
    return;
  }
  int mid = (s + e) / 2;
  update(s, mid, i, dif, 2 * index, tree);
  update(mid + 1, e, i, dif, 2 * index + 1, tree);
  int n = log2(e - s + 1);
  if (n & 1) {
    tree[index] = tree[index * 2] | tree[index * 2 + 1];
  } else {
    tree[index] = tree[index * 2] ^ tree[index * 2 + 1];
  }
  return;
}
int main() {
  int n, m;
  cin >> n >> m;
  int pow = 1 << n;
  int a[pow];
  for (int i = 0; i < pow; i++) {
    cin >> a[i];
  }
  int tree[4 * pow + 1];
  build_segment(0, pow - 1, tree, a, 1);
  int p, b;
  for (int i = 0; i < m; ++i) {
    cin >> p >> b;
    update(0, pow - 1, p - 1, b, 1, tree);
    cout << tree[1] << endl;
  }
  return 0;
}
