#include <bits/stdc++.h>
using namespace std;
const long long N = 2e5 + 5;
const long long mod = 1e9 + 7;
vector<long long> v;
vector<long long> seg(3 * N, 0);
long long segtree(long long start, long long end, long long curr, long long x) {
  if (start == end) return seg[curr] = v[start];
  long long mid = (start + end) / 2;
  long long left = segtree(start, mid, 2 * curr + 1, x + 1);
  long long right = segtree(mid + 1, end, 2 * curr + 2, x + 1);
  if (x % 2)
    return seg[curr] = (left | right);
  else
    return seg[curr] = (left ^ right);
}
long long updateSeg(long long start, long long end, long long curr,
                    long long idx, long long val, long long x) {
  if (start == end) {
    if (start == idx) seg[curr] = val;
    return seg[curr];
  }
  if (idx < start || idx > end) return seg[curr];
  long long mid = (start + end) / 2;
  long long left = updateSeg(start, mid, 2 * curr + 1, idx, val, x + 1);
  long long right = updateSeg(mid + 1, end, 2 * curr + 2, idx, val, x + 1);
  if (x % 2)
    return seg[curr] = (left | right);
  else
    return seg[curr] = (left ^ right);
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long i = 0;
  long long n, a, m;
  cin >> n >> m;
  for (i = 0; i < (1 << n); i++) {
    cin >> a;
    v.push_back(a);
  }
  long long k = (1 << n) - 1;
  long long p, b;
  long long parity = n % 2;
  long long val = segtree(0, k, 0, parity);
  for (i = 0; i < m; i++) {
    cin >> p >> b;
    long long val = updateSeg(0, k, 0, p - 1, b, parity);
    cout << val << endl;
  }
}
