#include <bits/stdc++.h>
using namespace std;
int n, q;
int a[1000050];
int nodos = 1;
int L[2000100];
int R[2000100];
int st[2000100];
int n1;
void build(int pos = 0, int l = 0, int r = n - 1, int ope = (n1 + 1) % 2) {
  if (l == r) {
    st[pos] = a[l];
    return;
  }
  int mi = (l + r) / 2;
  if (L[pos] == 0) {
    L[pos] = nodos++;
  }
  if (R[pos] == 0) {
    R[pos] = nodos++;
  }
  build(L[pos], l, mi, (ope + 1) % 2);
  build(R[pos], mi + 1, r, (ope + 1) % 2);
  if (ope == 0)
    st[pos] = (st[L[pos]] | st[R[pos]]);
  else
    st[pos] = st[L[pos]] ^ st[R[pos]];
}
void update(int p, int x, int pos = 0, int l = 0, int r = n - 1,
            int ope = (n1 + 1) % 2) {
  if (l == r) {
    st[pos] = x;
    return;
  }
  int mi = (l + r) / 2;
  if (l <= p && p <= mi)
    update(p, x, L[pos], l, mi, (ope + 1) % 2);
  else
    update(p, x, R[pos], mi + 1, r, (ope + 1) % 2);
  if (ope == 0)
    st[pos] = st[L[pos]] | st[R[pos]];
  else
    st[pos] = st[L[pos]] ^ st[R[pos]];
}
int queries(int ll, int rr, int pos = 0, int l = 0, int r = n - 1,
            int ope = (n1 + 1) % 2) {
  if (ll > r or rr < l) return 0;
  if (ll <= l and r <= rr) return st[pos];
  int mid = (l + r) / 2;
  int leftans = queries(ll, rr, L[pos], l, mid, (ope + 1) % 2);
  int rightans = queries(ll, rr, R[pos], mid + 1, r, (ope + 1) % 2);
  if (ope == 0) return leftans | rightans;
  return leftans ^ rightans;
}
int main() {
  cin >> n1 >> q;
  n = (1 << n1);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  build();
  int x, y;
  for (int i = 0; i < q; i++) {
    cin >> x >> y;
    update(x - 1, y);
    cout << queries(0, n - 1) << endl;
  }
  return 0;
}
