#include <bits/stdc++.h>
using namespace std;
const long long M = 998244353;
const long long N = 2e6 + 10;
const long long IM = 1e18 + 37;
inline void PP(long long n) { cout << n << " "; }
void PV(vector<long long> v) {
  for (long long i = 0; i < v.size(); i++) cout << v[i] << " ";
  cout << "\n";
}
void PVV(vector<pair<long long, long long> > v) {
  for (long long i = 0; i < v.size(); i++)
    cout << v[i].first << " " << v[i].second << "\n";
}
void PA(long long v[], long long n, long long x = 0) {
  for (long long i = x; i < n + x; i++) cout << v[i] << ' ';
  cout << "\n";
}
void IN(long long a[], long long n, long long x = 0) {
  for (long long i = x; i < n + x; i++) cin >> a[i];
}
inline void op() {}
long long tree[3 * N], a[N];
long long build(long long node, long long start, long long end) {
  if (start == end) {
    tree[node] = a[start];
    return 0;
  } else {
    long long mid = (start + end) / 2;
    long long x = build(2 * node, start, mid);
    x = build(2 * node + 1, mid + 1, end);
    if (x)
      tree[node] = tree[2 * node] ^ tree[2 * node + 1];
    else
      tree[node] = tree[2 * node] | tree[2 * node + 1];
    return 1 - x;
  }
}
long long update(long long node, long long start, long long end, long long idx,
                 long long val) {
  if (start == end) {
    a[idx] = val;
    tree[node] = val;
    return 0;
  } else {
    long long mid = (start + end) / 2;
    long long x = 0;
    if (start <= idx and idx <= mid) {
      x = update(2 * node, start, mid, idx, val);
    } else {
      x = update(2 * node + 1, mid + 1, end, idx, val);
    }
    if (x)
      tree[node] = tree[2 * node] ^ tree[2 * node + 1];
    else
      tree[node] = tree[2 * node] | tree[2 * node + 1];
    return 1 - x;
  }
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  op();
  long long n, m;
  cin >> n >> m;
  n = pow(2, n);
  IN(a, n, 1);
  build(1, 1, n);
  while (m--) {
    long long x, y;
    cin >> x >> y;
    update(1, 1, n, x, y);
    cout << tree[1] << "\n";
  }
  return 0;
}
