#include <bits/stdc++.h>
using namespace std;
const long long M = 1e9 + 7;
const long long MaxM = 1e13;
void fast() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
}
void yes() { cout << "A" << endl; }
void no() { cout << "B" << endl; }
vector<long long> d(1e5 + 3), par(1e5 + 5);
void pnt(int x) {
  if (x != 1) {
    pnt(par[x]);
  }
  cout << x << " ";
}
void solve() {
  long long n, m;
  cin >> n >> m;
  vector<long long> v(pow(2, n));
  for (int i = 0; i < pow(2, n); i++) {
    cin >> v[i];
  }
  long long p = pow(2, n);
  long long j = 0, c = 1;
  while (p > 1) {
    if (c == 1) {
      for (int i = 0; i < p; i += 2) {
        v.push_back(v[j + i] | v[j + i + 1]);
      }
      c = 0;
    } else {
      for (int i = 0; i < p; i += 2) {
        v.push_back(v[j + i] ^ v[j + i + 1]);
      }
      c = 1;
    }
    j += p;
    p /= 2;
  }
  v.push_back(0);
  reverse(v.begin(), v.end());
  while (m--) {
    long long a, b;
    cin >> a >> b;
    a = v.size() - a;
    v[a] = b;
    c = 1;
    a /= 2;
    while (a > 0) {
      if (c == 1) {
        v[a] = v[2 * a + 1] | v[2 * a];
      } else {
        v[a] = v[2 * a + 1] ^ v[2 * a];
      }
      c = 1 - c;
      a /= 2;
    }
    cout << v[1] << endl;
  }
}
int main() {
  fast();
  int t = 1;
  while (t--) {
    solve();
  }
}
