#include <bits/stdc++.h>
using namespace std;
const long long N = 2e5 + 10, MAXN = 2e6 + 10, M = 1e18, mod = 1e9 + 7,
                mod2 = 1e9 + 9, mod3 = 998244353;
void sieve(int n) {
  int lp[n + 1];
  memset(lp, 0, sizeof(lp));
  vector<int> pr;
  for (int i = 2; i <= n; ++i) {
    if (lp[i] == 0) {
      lp[i] = i;
      pr.push_back(i);
    }
    for (int j = 0; j < (int)pr.size() && pr[j] <= lp[i] && i * pr[j] <= N; ++j)
      lp[i * pr[j]] = pr[j];
  }
}
int n, t[MAXN];
int a[MAXN];
void build(int v, int tl, int tr, bool flag) {
  if (tl == tr) {
    t[v] = a[tl];
  } else {
    int tm = (tl + tr) / 2;
    build(v * 2, tl, tm, !flag);
    build(v * 2 + 1, tm + 1, tr, !flag);
    if (!flag)
      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 flag) {
  if (tl == tr)
    t[v] = new_val;
  else {
    int tm = (tl + tr) / 2;
    if (pos <= tm)
      update(v * 2, tl, tm, pos, new_val, !flag);
    else
      update(v * 2 + 1, tm + 1, tr, pos, new_val, !flag);
    if (!flag)
      t[v] = t[v * 2] ^ t[v * 2 + 1];
    else
      t[v] = t[v * 2] | t[v * 2 + 1];
  }
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  int m;
  cin >> n >> m;
  for (int i = 0; i < (1 << n); i++) cin >> a[i];
  build(1, 0, (1 << n) - 1, n % 2);
  for (int i = 0; i < m; i++) {
    int p, b;
    cin >> p >> b;
    update(1, 0, (1 << n) - 1, p - 1, b, n % 2);
    cout << t[1] << '\n';
  }
  return 0;
}
