#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
vector<long long int> arr(600000);
vector<long long int> segtree(600000);
void constructtree(int l, int h, int pos, int level) {
  if (l == h) {
    segtree[pos] = arr[l];
    return;
  }
  int mid = (l + h) / 2;
  constructtree(l, mid, 2 * pos, !level);
  constructtree(mid + 1, h, 2 * pos + 1, !level);
  if (level) {
    segtree[pos] = (segtree[2 * pos] | segtree[2 * pos + 1]);
  } else
    segtree[pos] = (segtree[2 * pos] ^ segtree[2 * pos + 1]);
}
void update(int l, int h, int up, int val, int pos, int level) {
  if (l == h) {
    arr[up] = val;
    segtree[pos] = val;
    return;
  }
  int mid = (l + h) / 2;
  if (l <= up && up <= mid) {
    update(l, mid, up, val, 2 * pos, !level);
  } else
    update(mid + 1, h, up, val, 2 * pos + 1, !level);
  if (level) {
    segtree[pos] = segtree[2 * pos] | segtree[2 * pos + 1];
  } else
    segtree[pos] = segtree[2 * pos] ^ segtree[2 * pos + 1];
}
int main() {
  long long int n, m;
  cin >> n >> m;
  for (int i = 1; i <= (1 << n); i++) cin >> arr[i];
  long long int level = n % 2;
  constructtree(1, 1 << n, 1, level);
  for (int i = 0; i < m; i++) {
    long long int a, b;
    cin >> a >> b;
    update(1, (1 << n), a, b, 1, level);
    cout << segtree[1] << endl;
  }
  return (0);
}
