#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10;
int a[N];
int tree[4 * N];
void build(int idx, int l, int r, bool lvl) {
  if (l == r) {
    tree[idx] = a[l];
    return;
  }
  int mid = (l + r) / 2;
  build(idx * 2, l, mid, lvl ^ 1);
  build(idx * 2 + 1, mid + 1, r, lvl ^ 1);
  if (lvl) {
    tree[idx] = (tree[idx * 2] | tree[idx * 2 + 1]);
  } else {
    tree[idx] = (tree[idx * 2] ^ tree[idx * 2 + 1]);
  }
}
void update(int idx, int l, int r, int pos, int value, int lvl) {
  if (pos > r || pos < l) {
    return;
  }
  if (l == r) {
    tree[idx] = value;
    return;
  }
  int mid = (l + r) / 2;
  update(idx * 2, l, mid, pos, value, lvl ^ 1);
  update(idx * 2 + 1, mid + 1, r, pos, value, lvl ^ 1);
  if (lvl) {
    tree[idx] = (tree[idx * 2] | tree[idx * 2 + 1]);
  } else {
    tree[idx] = (tree[idx * 2] ^ tree[idx * 2 + 1]);
  }
}
void print(int idx, int l, int r, int lvl);
int main() {
  if (!0) {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
  }
  int n, m;
  cin >> n >> m;
  for (int i = 1; i <= 1 << n; i++) {
    cin >> a[i];
  }
  build(1, 1, 1 << n, n % 2);
  if (0) {
    cout << "\nDebug : \n";
    cout << tree[1] << endl;
    print(1, 1, 1 << n, 1);
    cout << "Ending ...\n\n";
  }
  int p, b;
  while (m--) {
    cin >> p >> b;
    update(1, 1, 1 << n, p, b, n % 2);
    if (0) {
      cout << "\nDebug : \n";
      print(1, 1, 1 << n, 1);
      cout << "Ending ...\n\n";
    }
    cout << tree[1] << endl;
  }
  return 0;
}
void print(int idx, int l, int r, int lvl) {
  if (l == r) {
    cout << lvl << " " << tree[idx] << endl;
    return;
  }
  int mid = (l + r) / 2;
  print(idx * 2, l, mid, lvl + 1);
  print(idx * 2 + 1, mid + 1, r, lvl + 1);
  cout << lvl << " " << tree[idx] << endl;
}
