#include <bits/stdc++.h>
using namespace std;
int n, tree[4 * 131075], a[131075];
inline void make(int node, int left, int right, int h) {
  if (left == right) {
    tree[node] = a[left];
    return;
  }
  int mid = (left + right) / 2, l = 2 * node, r = l + 1;
  make(l, left, mid, h + 1);
  make(r, mid + 1, right, h + 1);
  if ((n - h) % 2 == 1)
    tree[node] = tree[l] | tree[r];
  else
    tree[node] = tree[l] ^ tree[r];
  return;
}
inline void update(int node, int left, int right, int x, int v, int h) {
  if (x < left || x > right) return;
  if (x == left && x == right) {
    tree[node] = v;
    return;
  }
  int mid = (left + right) / 2, l = 2 * node, r = l + 1;
  update(l, left, mid, x, v, h + 1);
  update(r, mid + 1, right, x, v, h + 1);
  if ((n - h) % 2 == 1)
    tree[node] = tree[l] | tree[r];
  else
    tree[node] = tree[l] ^ tree[r];
}
int main() {
  int m;
  scanf("%d %d", &n, &m);
  for (int i = 1; i <= (1 << n); i++) scanf("%d", &a[i]);
  make(1, 1, 1 << n, 0);
  while (m--) {
    int p, x;
    scanf("%d %d", &p, &x);
    update(1, 1, 1 << n, p, x, 0);
    printf("%d\n", tree[1]);
  }
  return 0;
}
