#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e6 + 7;
long long arr[MOD], tree[4 * MOD];
int n, m;
void buildTree(int node, int turn, int a, int b) {
  if (a > b) return;
  if (a == b) {
    tree[node] = arr[a];
    return;
  }
  buildTree(2 * node, !turn, a, (a + b) / 2);
  buildTree(2 * node + 1, !turn, 1 + (a + b) / 2, b);
  if (n % 2 == turn) {
    tree[node] = tree[2 * node] | tree[2 * node + 1];
  } else {
    tree[node] = tree[2 * node] ^ tree[2 * node + 1];
  }
}
void update(int node, int turn, int a, int b, int p, int val) {
  if (a > p || b < p || a > b) return;
  if (a == b && a == p) {
    tree[node] = val;
    return;
  }
  int mid = (a + b) / 2;
  if (p <= mid) {
    update(2 * node, !turn, a, mid, p, val);
  } else {
    update(2 * node + 1, !turn, mid + 1, b, p, val);
  }
  if (n % 2 == turn) {
    tree[node] = tree[2 * node] | tree[2 * node + 1];
  } else {
    tree[node] = tree[2 * node] ^ tree[2 * node + 1];
  }
}
int main(int argc, char const *argv[]) {
  std::ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> m;
  int size = 1 << n;
  int p, val;
  for (int i = 1; i <= size; ++i) {
    cin >> arr[i];
  }
  buildTree(1, 1, 1, size);
  for (int i = 0; i < m; ++i) {
    cin >> p >> val;
    update(1, 1, 1, size, p, val);
    cout << tree[1] << endl;
  }
  return 0;
}
