#include <bits/stdc++.h>
using namespace std;
void build(vector<long long>& a, long long s, long long e,
           vector<long long>& tree, long long index) {
  if (s == e) {
    tree[index] = a[s];
    return;
  }
  long long mid = (s + e) >> 1ll;
  build(a, s, mid, tree, index * 2);
  build(a, mid + 1, e, tree, index * 2 + 1);
  int times = log2(e - s + 1);
  if (times & 1)
    tree[index] = tree[2 * index] | tree[2 * index + 1];
  else
    tree[index] = tree[2 * index] ^ tree[2 * index + 1];
}
void update(vector<long long>& tree, long long ss, long long se, long long p,
            long long b, long long index) {
  if (p < ss || p > se) return;
  if (ss == se) {
    tree[index] = b;
    return;
  }
  long long mid = (ss + se) >> 1ll;
  update(tree, ss, mid, p, b, 2 * index);
  update(tree, mid + 1, se, p, b, 2 * index + 1);
  int times = log2(se - ss + 1);
  if (times & 1)
    tree[index] = tree[2 * index] | tree[2 * index + 1];
  else
    tree[index] = tree[2 * index] ^ tree[2 * index + 1];
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  long long n, m;
  cin >> n >> m;
  n = 1ll << n;
  vector<long long> a(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  vector<long long> tree(4 * n + 1);
  build(a, 0, n - 1, tree, 1);
  while (m--) {
    long long p, b;
    cin >> p >> b;
    p--;
    update(tree, 0, n - 1, p, b, 1);
    cout << tree[1] << "\n";
  }
  return 0;
}
