#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization("unroll-loops")
using namespace std;
const long long mod = 1000000007;
void fio() {}
template <typename T>
void TIME(T start, T end) {}
long long segtree[1000000];
void build(long long a[], long long v, long long tl, long long tr, int level) {
  if (tl == tr) {
    segtree[v] = a[tl];
  } else {
    long long tm = (tl + tr) / 2;
    build(a, v * 2, tl, tm, level - 1);
    build(a, v * 2 + 1, tm + 1, tr, level - 1);
    if (level % 2)
      segtree[v] = segtree[v * 2] | segtree[v * 2 + 1];
    else
      segtree[v] = segtree[v * 2] ^ segtree[v * 2 + 1];
  }
}
void update(long long v, long long tl, long long tr, long long pos,
            long long new_val, long long level) {
  if (tl == tr) {
    segtree[v] = new_val;
  } else {
    long long tm = (tl + tr) / 2;
    if (pos <= tm)
      update(v * 2, tl, tm, pos, new_val, level - 1);
    else
      update(v * 2 + 1, tm + 1, tr, pos, new_val, level - 1);
    if (level % 2) {
      segtree[v] = segtree[v * 2] | segtree[v * 2 + 1];
    } else {
      segtree[v] = segtree[v * 2] ^ segtree[v * 2 + 1];
    }
  }
}
int main() {
  auto start = chrono::high_resolution_clock::now();
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  fio();
  int t = 1;
  while (t--) {
    int n, m;
    cin >> n >> m;
    int N = pow(2, n);
    long long a[N];
    for (long long i = 0; i < N; i++) cin >> a[i];
    std::fill_n(segtree, 4 * N, 0);
    build(a, 1, 0, N - 1, n);
    while (m--) {
      long long pos, val;
      cin >> pos >> val;
      pos--;
      update(1, 0, N - 1, pos, val, n);
      cout << segtree[1] << '\n';
    }
  }
  auto end = chrono::high_resolution_clock::now();
  TIME(start, end);
  return 0;
}
