#include <bits/stdc++.h>
using namespace std;
int n, m;
int a[400011];
int p, b;
bool isor(int a) { return ((n - (int)((log(a) / log(2)) + 1e-5)) & 1); }
int main() {
  cin >> n >> m;
  int num = 1 << n;
  int tmp = num - 1;
  for (int i = 1; i <= num; i++) {
    scanf("%d", &a[tmp + i]);
  }
  for (int i = tmp; i; i--) {
    a[i] = (isor(i) ? (a[i << 1] | a[(i << 1) + 1])
                    : (a[i << 1] ^ a[(i << 1) + 1]));
  }
  for (int i = 1; i <= m; i++) {
    scanf("%d %d", &p, &b);
    a[tmp + p] = b;
    for (int i = (tmp + p) >> 1; i >= 1; i >>= 1)
      a[i] = (isor(i) ? (a[i << 1] | a[(i << 1) + 1])
                      : (a[i << 1] ^ a[(i << 1) + 1]));
    printf("%d\n", a[1]);
  }
  return 0;
}
