#include <bits/stdc++.h>
using namespace std;
long long int mod = 1000000007;
long long int tree[1000000];
long long int val[1000000], ct = 0;
void build(int node, int start, int end, long long int a[], int op) {
  if (start == end) {
    tree[node] = a[start];
    val[start] = node;
  } else {
    int mid = (start + end) / 2;
    build(2 * node + 1, start, mid, a, 1 - op);
    build(2 * node + 2, mid + 1, end, a, 1 - op);
    if (op == 1)
      tree[node] = tree[2 * node + 1] ^ tree[2 * node + 2];
    else
      tree[node] = tree[2 * node + 1] | tree[2 * node + 2];
  }
}
void update(long long int a[], int node, int start, int end, long long int i,
            long long int key, int op) {
  if (i < start || i > end) return;
  ct++;
  if (start == end) {
    tree[node] = key;
    a[i] = key;
  } else {
    int mid = (start + end) / 2;
    update(a, 2 * node + 1, start, mid, i, key, 1 - op);
    update(a, 2 * node + 2, mid + 1, end, i, key, 1 - op);
    if (op == 1)
      tree[node] = tree[2 * node + 1] ^ tree[2 * node + 2];
    else
      tree[node] = tree[2 * node + 1] | tree[2 * node + 2];
  }
}
int main() {
  long long int n, m;
  scanf("%lld %lld", &n, &m);
  long long int num = pow(2, n);
  long long int arr[num];
  for (int i = 0; i < num; i++) {
    scanf("%lld", &arr[i]);
  }
  int op = (n % 2 == 0) ? 1 : 0;
  build(0, 0, num - 1, arr, op);
  while (m--) {
    long long int x, y;
    scanf("%lld %lld", &x, &y);
    update(arr, 0, 0, num - 1, x - 1, y, op);
    printf("%lld\n", tree[0]);
  }
  return 0;
}
