#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const long long mxN = 1e5 + 5;
long long a[(1 << 18)];
long long seg[4 * (1 << 18)];
void build_tree(long long id, long long left, long long right,
                long long depth) {
  if (left == right) {
    seg[id] = a[left];
    return;
  }
  long long mid = (left + right) / 2;
  build_tree(id * 2, left, mid, depth - 1);
  build_tree(id * 2 + 1, mid + 1, right, depth - 1);
  if (depth % 2 == 0) {
    seg[id] = seg[id * 2] ^ seg[2 * id + 1];
  } else {
    seg[id] = seg[2 * id] | seg[2 * id + 1];
  }
}
void query(long long id, long long left, long long right, long long depth,
           long long pos, long long val) {
  if (left == right) {
    seg[id] = val;
    return;
  }
  long long mid = (left + right) / 2;
  if (pos <= mid)
    query(2 * id, left, mid, depth - 1, pos, val);
  else
    query(2 * id + 1, mid + 1, right, depth - 1, pos, val);
  if (depth % 2 == 1) {
    seg[id] = seg[2 * id] | seg[2 * id + 1];
  } else
    seg[id] = seg[2 * id] ^ seg[2 * id + 1];
}
void solve() {
  long long n, m;
  cin >> n >> m;
  for (long long i = 1; i <= (1 << n); i++) {
    cin >> a[i];
  }
  build_tree(1, 1, (1 << n), n);
  for (long long q = 1; q <= m; q++) {
    long long p, b;
    cin >> p >> b;
    query(1, 1, (1 << n), n, p, b);
    cout << seg[1] << '\n';
  }
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long T = 1;
  while (T--) {
    solve();
  }
}
