#include <bits/stdc++.h>
using namespace std;
long long a[200500];
vector<long long> t(600500, -1);
long long binpow(long long a, long long b) {
  if (b == 1) {
    return a;
  }
  if (b == 0) {
    return 1;
  }
  if (b % 2 == 0) {
    long long g = binpow(a, b / 2);
    return g * g;
  } else {
    long long g = binpow(a, b / 2);
    return g * g * a;
  }
}
bool build(long long v, long long l, long long r) {
  if (l == r) {
    t[v] = a[l];
    return 1;
  }
  long long mid = (l + r) / 2;
  bool h = build(v * 2, l, mid);
  build(v * 2 + 1, mid + 1, r);
  if (t[v * 2 + 1] == -1) {
    t[v] = t[v * 2];
  } else if (h == 1) {
    t[v] = t[v * 2] | t[v * 2 + 1];
    return 0;
  } else {
    t[v] = t[v * 2] ^ t[v * 2 + 1];
    return 1;
  }
}
long long upd(long long v, long long l, long long r, long long pos,
              long long val) {
  if (l > pos || r < pos) {
    return 2;
  }
  if (l == r) {
    t[v] = val;
    return 1;
  }
  long long mid = (l + r) / 2;
  long long h = upd(v * 2, l, mid, pos, val);
  h = min(upd(v * 2 + 1, mid + 1, r, pos, val), h);
  if (t[v * 2 + 1] == -1) {
    t[v] = t[v * 2];
  } else if (h == 1) {
    t[v] = t[v * 2] | t[v * 2 + 1];
    return 0;
  } else if (h == 0) {
    t[v] = t[v * 2] ^ t[v * 2 + 1];
    return 1;
  }
  return 2;
}
int main() {
  long long n, m;
  cin >> n >> m;
  for (int i = 1; i <= binpow(2, n); i++) {
    cin >> a[i];
  }
  build(1, 1, binpow(2, n));
  n = binpow(2, n);
  for (int i = 1; i <= m; i++) {
    long long x, y;
    cin >> x >> y;
    upd(1, 1, n, x, y);
    cout << t[1] << endl;
  }
}
