#include <bits/stdc++.h>
using namespace std;
int dcmp(double a, double b) {
  return fabs(a - b) <= 1e-10 ? 0 : a < b ? -1 : 1;
}
const int MAX = (1 << 17) + 10;
struct node {
  long long val, level;
  node() {
    val = 0;
    level = 0;
  }
};
int n, m;
long long arr[MAX];
node seg[MAX << 2];
node merge(node &a, node &b) {
  node ret;
  ret.level = max(a.level, b.level);
  if (ret.level & 1) {
    ret.val = a.val | b.val;
    ret.level++;
  } else {
    ret.val = a.val ^ b.val;
    ret.level++;
  }
  return ret;
}
void build(int nd, int l, int r) {
  if (l == r) {
    seg[nd].val = arr[l];
    seg[nd].level = 1;
    return;
  }
  int mid = (l + r) >> 1;
  build(nd << 1, l, mid);
  build(nd << 1 | 1, mid + 1, r);
  seg[nd] = merge(seg[nd << 1], seg[nd << 1 | 1]);
}
void update(int nd, int l, int r, int idx, long long val) {
  if (l == r) {
    seg[nd].val = val;
    return;
  }
  int mid = (l + r) >> 1;
  if (idx <= mid)
    update(nd << 1, l, mid, idx, val);
  else
    update(nd << 1 | 1, mid + 1, r, idx, val);
  seg[nd] = merge(seg[nd << 1], seg[nd << 1 | 1]);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  cin >> n >> m;
  n = pow(2, n);
  for (int i = (1); i < (int)(n + 1); ++i) {
    cin >> arr[i];
  }
  build(1, 1, n);
  for (int i = 0; i < (int)(m); ++i) {
    long long p, b;
    cin >> p >> b;
    update(1, 1, n, p, b);
    cout << seg[1].val << '\n';
  }
}
