#include <bits/stdc++.h>
using namespace std;
long long t[400000];
long long a[131073];
void build(long long v, long long tl, long long tr, bool op) {
  if (tl == tr) {
    t[v] = a[tl];
    return;
  } else {
    long long tm = tl + (tr - tl) / 2;
    build(2 * v, tl, tm, !op);
    build(2 * v + 1, tm + 1, tr, !op);
    if (op)
      t[v] = t[2 * v] | t[2 * v + 1];
    else
      t[v] = t[2 * v] ^ t[2 * v + 1];
  }
}
void update(long long v, long long tl, long long tr, long long pos,
            long long val, bool op) {
  if (tl == tr) {
    t[v] = val;
    return;
  }
  long long tm = tl + (tr - tl) / 2;
  if (pos <= tm)
    update(2 * v, tl, tm, pos, val, !op);
  else
    update(2 * v + 1, tm + 1, tr, pos, val, !op);
  if (op)
    t[v] = t[2 * v] | t[2 * v + 1];
  else
    t[v] = t[2 * v] ^ t[2 * v + 1];
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long n, q;
  cin >> n >> q;
  long long size = 1 << n;
  for (long long i = 0; i < size; i++) {
    cin >> a[i];
  }
  build(1, 0, size - 1, n & 1);
  while (q--) {
    long long pos, val;
    cin >> pos >> val;
    pos--;
    update(1, 0, size - 1, pos, val, n & 1);
    cout << t[1] << '\n';
  }
}
