#include <bits/stdc++.h>
using namespace std;
vector<int> seg_tree;
int sz;
void create_seg_tree(int n) {
  int op = 0;
  int k = (1 << (n - 1));
  int c = k;
  for (int i = (1 << n) - 1; i > 0; i--) {
    int left = seg_tree[2 * i];
    int right = seg_tree[2 * i + 1];
    seg_tree[i] = (op ? left ^ right : left | right);
    k--;
    if (k == 0) {
      op = !op;
      k = (c = c / 2);
    }
  }
}
int query(int a, int b, int n) {
  int ind = n + a - 1;
  int op = 0;
  seg_tree[ind] = b;
  ind /= 2;
  while (ind != 0) {
    seg_tree[ind] = (op ? seg_tree[2 * ind] ^ seg_tree[2 * ind + 1]
                        : seg_tree[2 * ind] | seg_tree[2 * ind + 1]);
    ind /= 2;
    op = !op;
  }
  return seg_tree[1];
}
int main() {
  int n, m;
  cin >> n >> m;
  seg_tree.resize((1 << n) * 2);
  sz = seg_tree.size();
  for (int i = (1 << n); i < sz; i++) cin >> seg_tree[i];
  create_seg_tree(n);
  int a, b;
  for (int i = 0; i < m; i++) {
    cin >> a >> b;
    cout << query(a, b, 1 << n) << endl;
  }
  return 0;
}
