#include <bits/stdc++.h>
using namespace std;
const int N = 140000;
long long node[4 * N], t[4 * N], a[N], n, q;
void make_tree(int tag, int L, int R) {
  if (L == R - 1) {
    node[tag] = a[L];
    return;
  }
  make_tree(tag * 2, L, (L + R) / 2);
  make_tree(tag * 2 + 1, (L + R) / 2, R);
  t[tag] = 1 - t[tag * 2];
  node[tag] = (t[tag] == 1 ? (node[tag * 2] | node[tag * 2 + 1])
                           : (node[tag * 2] ^ node[tag * 2 + 1]));
}
void modify(int tag, int L, int R, int s, int val) {
  if (R <= s || s < L)
    return;
  else if (s == L && L == R - 1) {
    node[tag] = val;
    return;
  }
  modify(tag * 2, L, (L + R) / 2, s, val);
  modify(tag * 2 + 1, (L + R) / 2, R, s, val);
  node[tag] = (t[tag] == 1 ? (node[tag * 2] | node[tag * 2 + 1])
                           : (node[tag * 2] ^ node[tag * 2 + 1]));
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> q;
  n = (1 << n);
  for (int i = 0; i < n; i++) cin >> a[i];
  make_tree(1, 0, n);
  while (q--) {
    long long ind, val;
    cin >> ind >> val;
    modify(1, 0, n, ind - 1, val);
    cout << node[1] << endl;
  }
}
