#include <bits/stdc++.h>
using namespace std;
static long tree[700000], A[300000];
void build_tree(int n, int index, int left, int right) {
  if (left == right) {
    tree[index] = A[left];
    return;
  }
  if (left > right) {
    return;
  }
  build_tree(n - 1, index * 2 + 2, (right + left) / 2 + 1, right);
  build_tree(n - 1, index * 2 + 1, left, (right + left) / 2);
  if (n % 2 == 0) {
    tree[index] = (tree[index * 2 + 1] ^ tree[index * 2 + 2]);
  } else {
    tree[index] = (tree[index * 2 + 1] | tree[index * 2 + 2]);
  }
  return;
}
void query(int n, int index, int left, int right, int q_index, int change) {
  if (q_index == left && q_index == right) {
    tree[index] = change;
    return;
  }
  if (left == right) return;
  if (q_index < left || q_index > right) {
    return;
  }
  query(n - 1, index * 2 + 2, (right + left) / 2 + 1, right, q_index, change);
  query(n - 1, index * 2 + 1, left, (right + left) / 2, q_index, change);
  if (n % 2 == 0) {
    tree[index] = (tree[index * 2 + 1] ^ tree[index * 2 + 2]);
  } else {
    tree[index] = (tree[index * 2 + 1] | tree[index * 2 + 2]);
  }
  return;
}
int main() {
  int n, m;
  cin >> n >> m;
  int b = 1 << n;
  for (int i = 0; i < b; i++) {
    cin >> A[i];
  }
  int B[2 * b + 2];
  build_tree(n, 0, 0, b - 1);
  while (m--) {
    int x, y;
    cin >> x >> y;
    query(n, 0, 0, b - 1, x - 1, y);
    cout << tree[0] << endl;
  }
}
