#include <bits/stdc++.h>
using namespace std;
int t[8800001];
int a[4000001];
int master, master1;
int orr, xorr, orrf, xorrf;
int single(int x) { return x; }
int combine(int a, int b) { return (a | b); }
int combine1(int a, int b) { return (a ^ b); }
void build(int op, int a[], int v, int tl, int tr) {
  if (tl == tr) {
    t[v] = single(a[tl]);
  } else {
    int mid = (tl + tr) / 2;
    build(op ^ 1, a, 2 * v, tl, mid);
    build(op ^ 1, a, 2 * v + 1, mid + 1, tr);
    if (op)
      t[v] = combine(t[2 * v], t[2 * v + 1]);
    else
      t[v] = combine1(t[2 * v], t[2 * v + 1]);
  }
}
void update(int op, int v, int tl, int tr, int ind, int new_val) {
  if (tl == tr) {
    t[v] = single(new_val);
  } else {
    int mid = (tl + tr) / 2;
    if (ind <= mid)
      update(!op, 2 * v, tl, mid, ind, new_val);
    else
      update(!op, 2 * v + 1, mid + 1, tr, ind, new_val);
    if (op)
      t[v] = combine(t[2 * v], t[2 * v + 1]);
    else
      t[v] = combine1(t[2 * v], t[2 * v + 1]);
  }
}
void solve() {
  int n, q;
  cin >> n >> q;
  int sum = 0;
  for (int i = 0; i < (1 << n); i++) cin >> a[i];
  int ff = n % 2;
  build(ff, a, 1, 0, (1 << n) - 1);
  while (q--) {
    orr = (1 << n);
    xorr = (1 << n);
    orrf = 1, xorrf = 0;
    int p, b;
    cin >> p >> b;
    update(ff, 1, 0, (1 << n) - 1, p - 1, b);
    cout << t[1] << "\n";
  }
}
int main() {
  cin.sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  while (t--) {
    solve();
  }
}
