#include <bits/stdc++.h>
using namespace std;
vector<int> ar;
int n;
class segtree {
 public:
  int N;
  vector<int> segT, lazy;
  segtree(int p) {
    N = p - 1;
    segT.resize((N << 1));
    if (n % 2 == 0)
      build(1, 1, N, 0);
    else {
      build(1, 1, N, 1);
    }
  }
  void build(int node, int l, int r, bool o) {
    if (l == r) {
      segT[node] = ar[l];
      return;
    }
    int mid = l + r >> 1;
    build(node << 1, l, mid, !o);
    build(node << 1 | 1, mid + 1, r, !o);
    if (o == 1)
      segT[node] = segT[node << 1] | segT[node << 1 | 1];
    else {
      segT[node] = segT[node << 1] ^ segT[node << 1 | 1];
    }
  }
  int query(int i, int j) { return query(1, 1, N, i, j); }
  int query(int node, int l, int r, int i, int j) {
    if (i > r || j < l) return 0;
    if (i <= l && j >= r) {
      return segT[node];
    }
    return 0;
  }
  void updatePoint(int idx, int val, bool o) {
    int cur = idx + N - 1;
    segT[cur] = val;
    while (cur != 1) {
      cur >>= 1;
      if (o == 1)
        segT[cur] = segT[cur << 1] | segT[cur << 1 | 1];
      else {
        segT[cur] = segT[cur << 1] ^ segT[cur << 1 | 1];
      }
      o = !o;
    }
  }
};
void solve() {
  int tt;
  cin >> n >> tt;
  int N = 1;
  N = 1 << n;
  N = int(N);
  ar.resize(N + 1, 0);
  for (int i = 1; i <= N; ++i) {
    cin >> ar[i];
  }
  segtree sg(N + 1);
  while (tt--) {
    int idx, va;
    cin >> idx >> va;
    sg.updatePoint(idx, va, 1);
    cout << sg.query(1, N) << endl;
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr), cout.tie(nullptr);
  solve();
  return 0;
}
