#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
void oj() {}
long long binpow(long long a, long long b, long long m) {
  a %= m;
  long long res = 1;
  while (b > 0) {
    if (b & 1) res = res * a % m;
    a = a * a % m;
    b >>= 1;
  }
  return res;
}
long long seg[4 * (1 << 18)];
void buildSeg(long long ind, long long low, long long high,
              vector<long long> &a, long long n, long long level) {
  if (low == high) {
    seg[ind] = a[low];
    return;
  }
  long long mid = (low + high) >> 1ll;
  buildSeg(2 * ind + 1, low, mid, a, n, level + 1);
  buildSeg(2 * ind + 2, mid + 1, high, a, n, level + 1);
  if ((n % 2 == 0 && level % 2 == 1) || (n % 2 == 1 && level % 2 == 0))
    seg[ind] = (seg[2 * ind + 1] | seg[2 * ind + 2]);
  else
    seg[ind] = (seg[2 * ind + 1] ^ seg[2 * ind + 2]);
}
void update(long long ind, long long low, long long high, vector<long long> &a,
            long long n, long long level, long long idx, long long val) {
  if (low == high) {
    seg[ind] = val;
    a[idx] = val;
    return;
  }
  long long mid = (low + high) >> 1ll;
  if (idx <= mid)
    update(2 * ind + 1, low, mid, a, n, level + 1, idx, val);
  else
    update(2 * ind + 2, mid + 1, high, a, n, level + 1, idx, val);
  if ((n % 2 == 0 && level % 2 == 1) || (n % 2 == 1 && level % 2 == 0))
    seg[ind] = (seg[2 * ind + 1] | seg[2 * ind + 2]);
  else
    seg[ind] = (seg[2 * ind + 1] ^ seg[2 * ind + 2]);
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  oj();
  long long t = 1;
  while (t--) {
    long long n, m;
    cin >> n >> m;
    long long sz = (1 << n);
    vector<long long> a(sz);
    for (long long &x : a) cin >> x;
    buildSeg(0, 0, sz - 1, a, n, 0);
    while (m--) {
      long long p, q;
      cin >> p >> q;
      --p;
      update(0, 0, sz - 1, a, n, 0, p, q);
      cout << seg[0] << "\n";
    }
  }
  return 0;
}
