#include <bits/stdc++.h>
using namespace std;
const int di[] = {-1, 0, 1, 0};
const int dj[] = {0, 1, 0, -1};
const long long MOD = 1e9 + 7;
const long long INF = 1e9;
class SegmentTree {
 private:
  vector<int> st, A;
  int n;
  int left(int p) { return p << 1; }
  int right(int p) { return (p << 1) + 1; }
  void build(int p, int L, int R, bool ex) {
    if (L == R)
      st[p] = A[L];
    else {
      build(left(p), L, (L + R) / 2, !ex);
      build(right(p), (L + R) / 2 + 1, R, !ex);
      int p1 = st[left(p)], p2 = st[right(p)];
      st[p] = ex ? (p1 ^ p2) : (p1 | p2);
    }
  }
  int rmq(int p, int L, int R, int i, int j, bool ex) {
    if (i > R || j < L) return -1;
    if (L >= i && R <= j) return st[p];
    int p1 = rmq(left(p), L, (L + R) / 2, i, j, !ex);
    int p2 = rmq(right(p), (L + R) / 2 + 1, R, i, j, !ex);
    if (p1 == -1) return p2;
    if (p2 == -1) return p1;
    return ex ? (p1 ^ p2) : (p1 | p2);
  }
  int update_point(int p, int L, int R, int idx, int new_value, bool ex) {
    int i = idx, j = idx;
    if (i > R || j < L) return st[p];
    if (L == i && R == j) {
      A[i] = new_value;
      return st[p] = A[L];
    }
    int p1, p2;
    p1 = update_point(left(p), L, (L + R) / 2, idx, new_value, !ex);
    p2 = update_point(right(p), (L + R) / 2 + 1, R, idx, new_value, !ex);
    return st[p] = ex ? (p1 ^ p2) : (p1 | p2);
  }

 public:
  SegmentTree(const vector<int> &_A) {
    A = _A;
    n = (int)A.size();
    st.assign(4 * n, 0);
    build(1, 0, n - 1, (int)log2(n) % 2 == 0);
  }
  int rmq(int i, int j) {
    return rmq(1, 0, n - 1, i, j, (int)log2(n) % 2 == 0);
  }
  int update_point(int idx, int new_value) {
    return update_point(1, 0, n - 1, idx, new_value, (int)log2(n) % 2 == 0);
  }
};
int power(int n, int p) {
  if (p == 0) return 1;
  return n * power(n, p - 1);
}
int main() {
  ios::sync_with_stdio(false), cin.tie(0);
  int n, m;
  cin >> n >> m;
  n = power(2, n);
  vector<int> num(n);
  for (int i = 0; i < n; i++) cin >> num[i];
  SegmentTree seg(num);
  for (int i = 0; i < m; i++) {
    int p, b;
    cin >> p >> b;
    p--;
    seg.update_point(p, b);
    cout << seg.rmq(0, n - 1) << endl;
  }
  cin.ignore(), cin.get();
}
