#include <bits/stdc++.h>
using namespace std;
const long long MAX = 140000;
const long long MOD = 1000000007;
const double PI = 2 * acos(0.0);
const double EPS = 0.00000000001;
int tree[3 * MAX], arr[MAX], I, V;
int flag[3 * MAX];
void _merge(int pos) {
  if (flag[pos * 2]) {
    flag[pos] = 0;
    tree[pos] = tree[pos * 2] ^ tree[pos * 2 + 1];
  } else {
    flag[pos] = 1;
    tree[pos] = tree[pos * 2] | tree[pos * 2 + 1];
  }
}
void build(int pos, int l, int r) {
  if (l == r) {
    tree[pos] = arr[l];
    return;
  }
  int mid = (l + r) >> 1;
  build(pos * 2, l, mid);
  build(pos * 2 + 1, mid + 1, r);
  _merge(pos);
}
void update(int pos, int l, int r) {
  if (I > r or I < l)
    return;
  else if (l == r) {
    tree[pos] = V;
    return;
  }
  int mid = (l + r) >> 1;
  update(pos * 2, l, mid);
  update(pos * 2 + 1, mid + 1, r);
  _merge(pos);
}
int main() {
  int n, m;
  scanf("%d", &n), scanf("%d", &m);
  n = pow(2, n);
  for (int i = 1; i <= n; i++) scanf("%d", &arr[i]);
  memset(flag, 0, sizeof flag);
  build(1, 1, n);
  while (m--) {
    scanf("%d", &I), scanf("%d", &V);
    update(1, 1, n);
    printf("%d\n", tree[1]);
  }
  return 0;
}
