#include <bits/stdc++.h>
int seg[524289];
int S = 0, E;
int arr[131080];
int stat;
int build(int s = S, int e = E, int p = 1) {
  if (s == e) {
    seg[p] = arr[s];
    stat = 0;
    return seg[p];
  }
  int mid = (s + e) / 2;
  int b1 = build(s, mid, 2 * p);
  int b2 = build(mid + 1, e, 2 * p + 1);
  if (stat)
    seg[p] = b1 ^ b2;
  else
    seg[p] = b1 | b2;
  stat = 1 - stat;
  return seg[p];
}
void update(int pp, int x, int s = S, int e = E, int p = 1) {
  if (s == e) {
    seg[p] = x;
    stat = 0;
    return;
  }
  int mid = (s + e) / 2;
  if (pp <= mid)
    update(pp, x, s, mid, 2 * p);
  else
    update(pp, x, mid + 1, e, 2 * p + 1);
  if (stat) {
    seg[p] = seg[2 * p] ^ seg[2 * p + 1];
  } else {
    seg[p] = seg[2 * p] | seg[2 * p + 1];
  }
  stat = 1 - stat;
}
using namespace std;
int main() {
  int n, m;
  scanf("%d %d", &n, &m);
  n = pow(2, n);
  E = n - 1;
  for (int i = 0; i < n; i++) scanf("%d", &arr[i]);
  build();
  for (int i = 0; i < m; i++) {
    int pp, x;
    scanf("%d %d", &pp, &x);
    pp--;
    update(pp, x);
    printf("%d\n", seg[1]);
  }
  return 0;
}
