#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll seg[4 * (ll)(2e5 + 3)];
ll ar[(ll)(2e5 + 3)];
ll p, b;
ll ans(int a, int b, bool fl) {
  if (fl) {
    return a | b;
  }
  return a ^ b;
}
ll build(int st, int en, int ind, bool fl) {
  if (st == en) {
    seg[ind] = ar[st];
    return seg[ind];
  }
  seg[ind] = ans(build(st, (st + en) >> 1, ind << 1, !fl),
                 build(((st + en) >> 1) + 1, en, ind << 1 | 1, !fl), fl);
  return seg[ind];
}
void update(int st, int en, int ind, bool fl) {
  if (st == en && st == p) {
    seg[ind] = b;
    return;
  }
  if (p >= st && p <= en) {
    update(st, (st + en) >> 1, ind << 1, !fl);
    update(((st + en) >> 1) + 1, en, ind << 1 | 1, !fl);
    seg[ind] = ans(seg[ind << 1], seg[ind << 1 | 1], fl);
  }
}
int main() {
  ios_base ::sync_with_stdio(NULL);
  cin.tie(0);
  int n, m;
  cin >> n >> m;
  int si = 1 << n;
  for (int i = 0; i < si; i++) {
    cin >> ar[i + 1];
  }
  build(1, si, 1, n & 1);
  for (int i = 0; i < m; i++) {
    cin >> p >> b;
    update(1, si, 1, n & 1);
    cout << seg[1] << "\n";
  }
}
