#include <bits/stdc++.h>
using namespace std;
int tree[2 * 1310721 + 1];
int arr[1310721 + 1];
int n;
void build(int node, int start, int end) {
  if (start == end) {
    tree[node] = arr[start];
    return;
  }
  int mid = (start + end) / 2;
  build(2 * node, start, mid);
  build(2 * node + 1, mid + 1, end);
  int height = floor(log2(node));
  if ((n + 1 - height) % 2 == 0)
    tree[node] = tree[2 * node] | tree[2 * node + 1];
  else
    tree[node] = tree[2 * node] ^ tree[2 * node + 1];
}
void update(int start, int end, int node, int x, int value) {
  if (x < start || x > end) return;
  if (x >= start && x <= end) {
    if (start == end) {
      tree[node] = value;
      return;
    }
    int mid = (start + end) / 2;
    if (x > mid) {
      update(mid + 1, end, 2 * node + 1, x, value);
    } else {
      update(start, mid, 2 * node, x, value);
    }
    int height = floor(log2(node));
    if ((n + 1 - height) % 2 == 0)
      tree[node] = tree[2 * node] | tree[2 * node + 1];
    else
      tree[node] = tree[2 * node] ^ tree[2 * node + 1];
  }
}
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int q;
  cin >> n >> q;
  int pn = pow(2, n);
  for (int i = 1; pn >= i; i++) {
    cin >> arr[i];
  }
  build(1, 1, pn);
  while (q--) {
    int a, b;
    cin >> a >> b;
    update(1, pn, 1, a, b);
    cout << tree[1] << endl;
  }
}
