#include <bits/stdc++.h>
using namespace std;
long long int const inf = 1e18;
long long int const maxn = 1e6 + 5;
long long int const mod = 1e9 + 7;
long long binpow(long long a, long long b) {
  if (b == 0) return 1;
  long long res = binpow(a, b / 2);
  if (b % 2)
    return res * res * a;
  else
    return res * res;
}
vector<long long int> arr(maxn), t(maxn);
void build(long long int v, long long int tl, long long int tr,
           long long int decide) {
  if (tl == tr) {
    t[v] = arr[tl];
  } else {
    long long int tm = (tl + tr) / 2;
    build(v * 2, tl, tm, !decide);
    build(v * 2 + 1, tm + 1, tr, !decide);
    if (decide)
      t[v] = t[v * 2] | t[v * 2 + 1];
    else
      t[v] = t[v * 2] ^ t[v * 2 + 1];
  }
}
void update(long long int v, long long int tl, long long int tr,
            long long int pos, long long int new_val, long long int decide) {
  if (tl == tr) {
    t[v] = new_val;
  } else {
    long long int tm = (tl + tr) / 2;
    if (pos <= tm)
      update(v * 2, tl, tm, pos, new_val, !decide);
    else
      update(v * 2 + 1, tm + 1, tr, pos, new_val, !decide);
    if (decide)
      t[v] = t[v * 2] | t[v * 2 + 1];
    else
      t[v] = t[v * 2] ^ t[v * 2 + 1];
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int n, m;
  cin >> n >> m;
  long long int total = binpow(2, n);
  for (long long int i = 0; i < total; i++) cin >> arr[i];
  build(1, 0, total - 1, n % 2);
  while (m--) {
    long long int p, b;
    cin >> p >> b;
    update(1, 0, total - 1, p - 1, b, n % 2);
    cout << t[1] << "\n";
  }
  return 0;
}
