#include <bits/stdc++.h>
using namespace std;
const int max_N = 131072 + 10;
int N, a[max_N], seg[4 * max_N];
void update(int ind, int len) {
  if (len & 1)
    seg[ind] = seg[2 * ind] | seg[2 * ind + 1];
  else
    seg[ind] = seg[2 * ind] ^ seg[2 * ind + 1];
}
void build(int st = 0, int en = N, int ind = 1) {
  if (en - st == 1) {
    seg[ind] = a[st];
    return;
  }
  int mid = (st + en) / 2;
  build(st, mid, 2 * ind);
  build(mid, en, 2 * ind + 1);
  update(ind, log2(en - st));
}
void modify(int p, int val, int st = 0, int en = N, int ind = 1) {
  if (p < st || p >= en) return;
  if (en - st == 1) {
    seg[ind] = val;
    return;
  }
  int mid = (st + en) / 2;
  modify(p, val, st, mid, 2 * ind);
  modify(p, val, mid, en, 2 * ind + 1);
  update(ind, log2(en - st));
}
int main() {
  ios::sync_with_stdio(false);
  int n, m, p, b;
  cin >> n >> m;
  N = 1 << n;
  for (int i = 0; i < N; i++) cin >> a[i];
  build();
  while (m--) {
    cin >> p >> b;
    modify(p - 1, b);
    cout << seg[1] << endl;
  }
  return 0;
}
