#include <bits/stdc++.h>
using namespace std;
vector<int> arr, seg;
void build(int node, int l, int r, bool op) {
  if (l > r) return;
  if (l == r) {
    seg[node] = arr[l];
    return;
  }
  int mid = (l + r) / 2;
  build(2 * node + 1, l, mid, !op);
  build(2 * node + 2, mid + 1, r, !op);
  if (op == 0)
    seg[node] = (seg[2 * node + 1] | seg[2 * node + 2]);
  else
    seg[node] = (seg[2 * node + 1] ^ seg[2 * node + 2]);
}
void update(int node, int l, int r, int index, int value, bool op) {
  if (l > r or l > index or r < index) return;
  if (l == r and l == index) {
    seg[node] = value;
    return;
  }
  int mid = (l + r) / 2;
  update(2 * node + 1, l, mid, index, value, !op);
  update(2 * node + 2, mid + 1, r, index, value, !op);
  if (op == 0)
    seg[node] = (seg[2 * node + 1] | seg[2 * node + 2]);
  else
    seg[node] = (seg[2 * node + 1] ^ seg[2 * node + 2]);
}
int main() {
  int n, m;
  cin >> n >> m;
  int k = 1;
  for (int i = 1; i <= n; i++) k *= 2;
  arr.resize(k);
  seg.resize(5 * k);
  for (int i = 0; i < k; i++) cin >> arr[i];
  if (n % 2 == 0)
    build(0, 0, k - 1, 1);
  else
    build(0, 0, k - 1, 0);
  for (int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    a--;
    if (n % 2 == 0)
      update(0, 0, k - 1, a, b, 1);
    else
      update(0, 0, k - 1, a, b, 0);
    cout << seg[0] << endl;
  }
  return 0;
}
