#include <bits/stdc++.h>
using namespace std;
void build(std::vector<int> &v, int node, int left, int right, int n);
void update(vector<int> &v, int node, int left, int right, int pos, int val,
            int n);
int segtree[400100];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, m;
  cin >> n >> m;
  std::vector<int> v(1 << n + 5);
  for (int i = 0; i < 1 << n; i++) cin >> v[i];
  build(v, 1, 0, (1 << n) - 1, n);
  while (m--) {
    int q;
    cin >> q;
    int lp;
    cin >> lp;
    update(v, 1, 0, (1 << n) - 1, q - 1, lp, n);
    cout << segtree[1] << endl;
  }
}
void build(std::vector<int> &v, int node, int left, int right, int n) {
  if (left == right)
    segtree[node] = v[left];
  else {
    int mid = (left + right) / 2;
    build(v, 2 * node, left, mid, n - 1);
    build(v, 2 * node + 1, mid + 1, right, n - 1);
    if (n % 2 == 0)
      segtree[node] = segtree[2 * node] ^ segtree[2 * node + 1];
    else
      segtree[node] = segtree[2 * node] | segtree[2 * node + 1];
  }
}
void update(vector<int> &v, int node, int left, int right, int pos, int val,
            int n) {
  if (left == right) {
    segtree[node] = val;
    v[pos] = val;
  } else {
    int mid = (left + right) / 2;
    if (pos <= mid)
      update(v, 2 * node, left, mid, pos, val, n - 1);
    else
      update(v, 2 * node + 1, mid + 1, right, pos, val, n - 1);
    if (n % 2 == 0)
      segtree[node] = segtree[2 * node] ^ segtree[2 * node + 1];
    else
      segtree[node] = segtree[2 * node] | segtree[2 * node + 1];
  }
}
