#include <bits/stdc++.h>
using namespace std;
int n, m, p, b, a[131080], t[4 * 131080], h[4 * 131080];
void build(int a[], int v, int tl, int tr, bool ch) {
  if (tl == tr)
    t[v] = a[tl];
  else {
    int tm = (tl + tr) / 2;
    build(a, v * 2, tl, tm, !ch);
    build(a, v * 2 + 1, tm + 1, tr, !ch);
    if (ch == 0)
      t[v] = t[v * 2] ^ t[v * 2 + 1];
    else
      t[v] = t[v * 2] | t[v * 2 + 1];
  }
}
void update(int v, int tl, int tr, int pos, int new_val, bool ch) {
  if (tl == tr)
    t[v] = new_val;
  else {
    int tm = (tl + tr) / 2;
    if (pos <= tm)
      update(v * 2, tl, tm, pos, new_val, !ch);
    else
      update(v * 2 + 1, tm + 1, tr, pos, new_val, !ch);
    if (ch == 0)
      t[v] = t[v * 2] ^ t[v * 2 + 1];
    else
      t[v] = t[v * 2] | t[v * 2 + 1];
  }
}
int main() {
  cin >> n >> m;
  for (int i = 0; i < pow(2, n); i++) cin >> a[i];
  if (n % 2 == 0)
    h[1] = 0;
  else
    h[1] = 1;
  build(a, 1, 0, pow(2, n) - 1, h[1]);
  for (int i = 0; i < m; i++) {
    cin >> p >> b;
    p--;
    update(1, 0, pow(2, n) - 1, p, b, h[1]);
    cout << t[1] << endl;
  }
  return 0;
}
