#include <bits/stdc++.h>
using namespace std;
const int T = 1 << 17;
struct node {
  long long val;
  int level;
};
node segtree[2 * T];
long long inp[T];
void update(int p, int b) {
  segtree[T + p].val = b;
  segtree[T + p].level = 0;
  int temp = (T + p);
  temp /= 2;
  while (temp >= 1) {
    if (segtree[temp].level == 1) {
      segtree[temp].val =
          (segtree[2 * temp].val) | (segtree[(2 * temp) + 1].val);
    } else {
      segtree[temp].val =
          (segtree[2 * temp].val) ^ (segtree[(2 * temp) + 1].val);
    }
    temp /= 2;
  }
}
int main() {
  int n, m;
  scanf("%d %d", &n, &m);
  for (int i = 0; i < (1 << n); i++) {
    scanf("%lld", &inp[i]);
  }
  for (int i = 2 * T - 1; i >= 1; i--) {
    if (i >= T) {
      segtree[i].val = inp[i - T];
      segtree[i].level = 0;
    } else {
      if (segtree[2 * i].level == 0) {
        segtree[i].val = (segtree[2 * i].val | segtree[(2 * i) + 1].val);
        segtree[i].level = 1;
      } else {
        segtree[i].val = (segtree[2 * i].val ^ segtree[(2 * i) + 1].val);
        segtree[i].level = 0;
      }
    }
  }
  int p, b;
  for (int i = 0; i < m; i++) {
    scanf("%d %d", &p, &b);
    update(p - 1, b);
    printf("%lld\n", segtree[1].val);
  }
  return 0;
}
