#include <bits/stdc++.h>
using namespace std;
int n;
int m;
int* update(int* tree, int p, int v, bool isor) {
  tree[p] = v;
  if (p == 0) return tree;
  if (p % 2 == 0) {
    v = isor ? tree[p - 1] | tree[p] : tree[p - 1] ^ tree[p];
    p = p / 2 - 1;
  } else {
    v = isor ? tree[p] | tree[p + 1] : tree[p] ^ tree[p + 1];
    p = p / 2;
  }
  isor = isor ? false : true;
  tree = update(tree, p, v, isor);
  return tree;
}
int main() {
  scanf("%d %d", &n, &m);
  int input, cp_n = pow(2, n);
  queue<int> a;
  while (cp_n--) {
    scanf("%d", &input);
    a.push(input);
  }
  int total = 0;
  for (int i = 0; i < n + 1; i++) total += pow(2, i);
  int tree[total];
  bool isor = true;
  for (int i = n; i > 0; i--) {
    for (int j = 0; j < pow(2, i); j += 2) {
      int a1 = a.front();
      a.pop();
      tree[(int)pow(2, i) - 1 + j] = a1;
      int a2 = a.front();
      a.pop();
      tree[(int)pow(2, i) + j] = a2;
      isor ? a.push(a1 | a2) : a.push(a1 ^ a2);
    }
    isor = isor ? false : true;
  }
  int a1 = a.front();
  a.pop();
  tree[0] = a1;
  while (m--) {
    int* cpy_tree = tree;
    int p, v;
    scanf("%d %d", &p, &v);
    cpy_tree = update(cpy_tree, (int)pow(2, n) + p - 2, v, true);
    printf("%d\n", cpy_tree[0]);
  }
}
