#include <bits/stdc++.h>
using namespace std;
void build(long tree[], long arr[], int v, int tl, int tr, bool flag) {
  if (tl == tr)
    tree[v] = arr[tl];
  else {
    int tm = (tl + tr) / 2;
    build(tree, arr, v * 2, tl, tm, !flag);
    build(tree, arr, v * 2 + 1, tm + 1, tr, !flag);
    if (flag)
      tree[v] = tree[v * 2] | tree[v * 2 + 1];
    else
      tree[v] = tree[v * 2] ^ tree[v * 2 + 1];
  }
}
void update(long tree[], long v, int tl, int tr, int pos, long new_val,
            bool flag) {
  if (tl == tr)
    tree[v] = new_val;
  else {
    int tm = (tl + tr) / 2;
    if (pos <= tm)
      update(tree, v * 2, tl, tm, pos, new_val, !flag);
    else
      update(tree, v * 2 + 1, tm + 1, tr, pos, new_val, !flag);
    if (flag)
      tree[v] = tree[v * 2] | tree[v * 2 + 1];
    else
      tree[v] = tree[v * 2] ^ tree[v * 2 + 1];
  }
}
long ans(long tree[], int v, int tl, int tr, int l, int r) {
  if (l > r) return 0;
  if (l == tl && r == tr) return tree[v];
  return -1;
}
int main() {
  long n, m;
  scanf("%ld %ld", &n, &m);
  long N = 1 << n;
  long arr[N + 1];
  for (int i = 1; i <= N; i++) {
    scanf("%ld", &arr[i]);
  }
  long tree[4 * N + 1];
  bool flag = true;
  if ((int)(log2<int>(N)) % 2 == 0) flag = false;
  build(tree, arr, 1, 1, N, flag);
  for (int i = 0; i < m; i++) {
    long p, b;
    scanf("%ld %ld", &p, &b);
    update(tree, 1, 1, N, p, b, flag);
    printf("%ld\n", ans(tree, 1, 1, N, 1, N));
  }
  return 0;
}
