#include <bits/stdc++.h>
using namespace std;
map<long long, long long> M;
bool vis[100003];
long long w[1000000], t[1000003];
long long x, y, z, a, b, c, n, m, q, k, ans;
vector<long long> v2, v1, v;
long long poww(long long x, long long y) {
  if (x == 0) return 0;
  if (x == 1) return 1;
  if (y == 0) return 1;
  if (y == 1) return x;
  long long d = poww(x, y / 2);
  if (y % 2) return d * d * x;
  return d * d;
}
void build(long long nd, long long l, long long r, long long aw) {
  if (l == r) {
    t[nd] = w[l];
    return;
  }
  long long mid = (l + r) / 2;
  build(nd * 2, l, mid, 1 - aw);
  build(nd * 2 + 1, mid + 1, r, 1 - aw);
  if (aw)
    t[nd] = t[2 * nd] | t[nd * 2 + 1];
  else
    t[nd] = t[2 * nd] ^ t[nd * 2 + 1];
}
void up(long long nd, long long l, long long r, long long a, long long b,
        long long aw) {
  if (l == r) {
    t[nd] = b;
    return;
  }
  long long mid = (l + r) / 2;
  if (a >= l && a <= mid)
    up(nd * 2, l, mid, a, b, 1 - aw);
  else
    up(2 * nd + 1, mid + 1, r, a, b, 1 - aw);
  if (aw)
    t[nd] = t[2 * nd] | t[nd * 2 + 1];
  else
    t[nd] = t[nd * 2] ^ t[nd * 2 + 1];
}
long long a1, n1;
int main() {
  cin >> n >> m;
  n1 = poww(2, n);
  for (int i = 1; i <= n1; i++) cin >> w[i];
  a1 = n % 2;
  build(1, 1, n1, a1);
  while (m--) {
    scanf("%lld%lld", &a, &b);
    up(1, 1, n1, a, b, a1);
    printf("%lld\n", t[1]);
  }
  return 0;
}
