#include <bits/stdc++.h>
using namespace std;
int n, m, a[1000006], v[4000006], o[4000006], p1, p2;
int bt(int l, int r, int p) {
  if (l == r) {
    v[p] = a[l];
    return 0;
  }
  int mid = (l + r) / 2;
  o[p] = bt(l, mid, p * 2);
  bt(mid + 1, r, p * 2 + 1);
  if (o[p] == 0) {
    v[p] = v[p * 2] | v[p * 2 + 1];
  } else {
    v[p] = v[p * 2] ^ v[p * 2 + 1];
  }
  return 1 - o[p];
}
void mdf(int l, int r, int p) {
  if (l > p1 || r < p1) {
    return;
  }
  if (l == r) {
    v[p] = p2;
    return;
  }
  int mid = (l + r) / 2;
  mdf(l, mid, p * 2);
  mdf(mid + 1, r, p * 2 + 1);
  if (o[p] == 0) {
    v[p] = v[p * 2] | v[p * 2 + 1];
  } else {
    v[p] = v[p * 2] ^ v[p * 2 + 1];
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin >> n >> m;
  n = 1 << n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  bt(1, n, 1);
  for (int i = 0; i < m; i++) {
    cin >> p1 >> p2;
    mdf(1, n, 1);
    cout << v[1] << endl;
  }
  return 0;
}
