#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9 + 7;
const int N = 1 << 18;
int n;
int a[N], t[4 * N];
inline int f(int x, int y, int turn) {
  if (turn & 1)
    return x ^ y;
  else
    return x | y;
}
void build(int turn, int v = 1, int l = 0, int r = n) {
  if (l + 1 == r) {
    t[v] = a[l];
    return;
  }
  int mid = (l + r) / 2;
  build(turn ^ 1, 2 * v, l, mid);
  build(turn ^ 1, 2 * v + 1, mid, r);
  t[v] = f(t[2 * v], t[2 * v + 1], turn);
}
void modify(int p, int x, int turn, int v = 1, int l = 0, int r = n) {
  if (l + 1 == r) {
    t[v] = a[p] = x;
    return;
  }
  int mid = (l + r) / 2;
  if (p < mid)
    modify(p, x, turn ^ 1, 2 * v, l, mid);
  else
    modify(p, x, turn ^ 1, 2 * v + 1, mid, r);
  t[v] = f(t[2 * v], t[2 * v + 1], turn);
}
void solve() {
  int m;
  cin >> n >> m;
  int k = (n + 1) % 2;
  n = (1 << n);
  for (int i = 0; i < n; ++i) cin >> a[i];
  build(k);
  for (int i = 0; i < m; ++i) {
    int p, v;
    cin >> p >> v;
    --p;
    modify(p, v, k);
    cout << t[1] << '\n';
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.precision(10);
  cout << fixed;
  solve();
  return 0;
}
