#include <bits/stdc++.h>
using namespace std;
const int maxN = 18;
int n, a[1 << maxN], res[4 * (1 << maxN)];
int left(int i) { return 2 * i; }
int right(int i) { return 2 * i + 1; }
void build(int node = 1, int l = 0, int r = (1 << n), int height = n) {
  if (r - l < 2) {
    res[node] = a[l];
    return;
  }
  int mid = (l + r) / 2;
  build(left(node), l, mid, height - 1);
  build(right(node), mid, r, height - 1);
  if (height & 1)
    res[node] = res[left(node)] | res[right(node)];
  else
    res[node] = res[left(node)] ^ res[right(node)];
}
void upd(int ind, int val, int node = 1, int l = 0, int r = (1 << n),
         int height = n) {
  if (r - l < 2) {
    a[ind] = val;
    res[node] = val;
    return;
  }
  int mid = (l + r) / 2;
  if (ind < mid)
    upd(ind, val, left(node), l, mid, height - 1);
  else
    upd(ind, val, right(node), mid, r, height - 1);
  if (height & 1)
    res[node] = res[left(node)] | res[right(node)];
  else
    res[node] = res[left(node)] ^ res[right(node)];
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int m;
  cin >> n >> m;
  for (int i = 0; i < (1 << n); i++) cin >> a[i];
  build();
  while (m--) {
    int ind, val;
    cin >> ind >> val;
    ind--;
    upd(ind, val);
    cout << res[1] << endl;
  }
  return 0;
}
