#include <bits/stdc++.h>
using namespace std;
long b;
long seg[2000000];
long a[1000000];
void createSeg(int node, int first, int last, int bit) {
  if (first == last) {
    seg[node] = a[first];
    return;
  }
  int mid = (first + last) / 2;
  createSeg(2 * node, first, mid, bit * (-1));
  createSeg(2 * node + 1, mid + 1, last, bit * (-1));
  if (bit == -1)
    seg[node] = seg[node * 2] ^ seg[node * 2 + 1];
  else
    seg[node] = seg[node * 2] | seg[node * 2 + 1];
}
void update(int node, int first, int last, int index, int bit) {
  if (first == last) {
    seg[node] = b;
    return;
  }
  int mid = (first + last) / 2;
  if (index <= mid) {
    update(2 * node, first, mid, index, bit * (-1));
  }
  if (index > mid) {
    update(2 * node + 1, mid + 1, last, index, bit * (-1));
  }
  if (bit == -1)
    seg[node] = seg[node * 2] ^ seg[node * 2 + 1];
  else
    seg[node] = seg[node * 2] | seg[node * 2 + 1];
}
int main() {
  int n, m;
  cin >> n >> m;
  int no = 1 << n;
  for (int i = 0; i < no; i++) {
    cin >> a[i];
  }
  int bit;
  if (n % 2 == 0)
    bit = -1;
  else
    bit = 1;
  createSeg(1, 0, no - 1, bit);
  int p;
  while (m--) {
    cin >> p >> b;
    update(1, 0, no - 1, p - 1, bit);
    cout << seg[1] << endl;
  }
}
