#include <bits/stdc++.h>
using namespace std;
struct debugger {
  template <typename T>
  debugger &operator,(const T &v) {
    cerr << v << " ";
    return *this;
  }
} dbg;
inline void take(int &x) { scanf("%d", &x); }
inline void take(int &x, int &y) { scanf("%d %d", &x, &y); }
int a[1000000], tree[4 * 1000000];
void makeTree(int node, int b, int e) {
  if (b == e) {
    tree[node] = a[b];
    return;
  }
  int left = 2 * node;
  int right = left + 1;
  int m = (b + e) / 2;
  long long cnt = (e - b) + 1;
  makeTree(left, b, m);
  makeTree(right, m + 1, e);
  cnt = log2(cnt);
  if (cnt & 1)
    tree[node] = tree[left] | tree[right];
  else
    tree[node] = tree[left] ^ tree[right];
}
void update(int node, int b, int e, int i, int val) {
  int left = node * 2;
  int right = left + 1;
  int m = (b + e) / 2;
  if (b > i || e < i) return;
  if (b >= i && e <= i) {
    tree[node] = val;
    return;
  }
  update(left, b, m, i, val);
  update(right, m + 1, e, i, val);
  long long cnt = (e - b) + 1;
  cnt = log2(cnt);
  if (cnt & 1)
    tree[node] = tree[left] | tree[right];
  else
    tree[node] = tree[left] ^ tree[right];
}
int main() {
  int n, q;
  scanf("%d %d", &n, &q);
  n = pow(2, n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
  }
  makeTree(1, 1, n);
  for (int i = 0; i < q; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    update(1, 1, n, x, y);
    cout << tree[1] << endl;
  }
}
