#include <bits/stdc++.h>
using namespace std;
int a[4 * 131072];
void update(int i) {
  bool flag = true;
  i /= 2;
  while (i) {
    if (flag)
      a[i] = a[i << 1] | a[i << 1 | 1];
    else
      a[i] = a[i << 1] ^ a[i << 1 | 1];
    flag = !flag;
    i /= 2;
  }
}
int main() {
  int n, m;
  cin >> n >> m;
  n = 1 << n;
  for (int i = n; i < 2 * n; i++) {
    cin >> a[i];
    update(i);
  }
  for (int i = 0; i < m; i++) {
    int q, b;
    cin >> q >> b;
    a[n + q - 1] = b;
    update(n + q - 1);
    cout << a[1] << endl;
  }
  return 0;
}
