#include <bits/stdc++.h>
using namespace std;
int a[1 << 17];
int t[2 * (1 << 17)];
void build_tree(int v, int l, int r, int n) {
  if (l + 1 == r) {
    t[v] = a[l];
  } else {
    build_tree(2 * v, l, l + (r - l) / 2, n - 1);
    build_tree(2 * v + 1, l + (r - l) / 2, r, n - 1);
    if (n & 1) {
      t[v] = t[2 * v] | t[2 * v + 1];
    } else {
      t[v] = t[2 * v] ^ t[2 * v + 1];
    }
  }
}
int find_leaf(int i, int n) {
  int l = 0, r = (1 << n);
  int v = 1;
  while (l + 1 < r) {
    if (i < l + (r - l) / 2) {
      v = 2 * v;
      r = l + (r - l) / 2;
    } else {
      v = 2 * v + 1;
      l = l + (r - l) / 2;
    }
  }
  return v;
}
void update_tree(int v) {
  int k = 0;
  while (v > 1) {
    if (k == 0) {
      t[v / 2] = t[2 * (v / 2)] | t[2 * (v / 2) + 1];
    } else {
      t[v / 2] = t[2 * (v / 2)] ^ t[2 * (v / 2) + 1];
    }
    k = 1 - k;
    v /= 2;
  }
}
int main() {
  int n, m, p, b;
  cin >> n >> m;
  for (int i = 0; i < (1 << n); ++i) {
    cin >> a[i];
  }
  build_tree(1, 0, (1 << n), n);
  for (int i = 0; i < m; ++i) {
    cin >> p >> b;
    int x = find_leaf(p - 1, n);
    t[x] = b;
    update_tree(x);
    cout << t[1] << "\n";
  }
  return 0;
}
