#include <bits/stdc++.h>
using namespace std;
vector<long long int> segTree(10000000, 0);
vector<long long int> v(10000000, 0);
long long int n;
void build(long long int start, long long int end, long long int node,
           long long int distance) {
  if (start > end) return;
  if (start == end) {
    segTree[node] = v[start];
    return;
  }
  long long int mid = (start + end) / 2;
  build(start, mid, 2 * node + 1, distance + 1);
  build(mid + 1, end, 2 * node + 2, distance + 1);
  if (((n % 2 == 0) && (distance % 2 != 0)) ||
      ((n % 2 != 0) && (distance % 2 == 0))) {
    segTree[node] = (segTree[2 * node + 1] | segTree[2 * node + 2]);
  } else {
    segTree[node] = segTree[2 * node + 1] xor segTree[2 * node + 2];
  }
}
void update(long long int start, long long int end, long long int node,
            long long int distance, long long int idx, long long int value) {
  if (start > end) {
    return;
  }
  if (start == end) {
    segTree[node] = value;
    v[idx] = value;
    return;
  }
  long long int mid = (start + end) / 2;
  if (idx <= mid) {
    update(start, mid, 2 * node + 1, distance + 1, idx, value);
  } else {
    update(mid + 1, end, 2 * node + 2, distance + 1, idx, value);
  }
  if (((n % 2 == 0) && (distance % 2 != 0)) ||
      ((n % 2 != 0) && (distance % 2 == 0))) {
    segTree[node] = (segTree[2 * node + 1] | segTree[2 * node + 2]);
  } else {
    segTree[node] = segTree[2 * node + 1] xor segTree[2 * node + 2];
  }
}
int main() {
  long long int i;
  cin >> n;
  long long int m;
  cin >> m;
  for (i = int(0); i <= int(pow(2, n) - 1); i++) {
    cin >> v[i];
  }
  build(0, pow(2, n) - 1, 0, 0);
  while (m--) {
    long long int x;
    cin >> x;
    long long int y;
    cin >> y;
    update(0, pow(2, n) - 1, 0, 0, x - 1, y);
    cout << segTree[0] << "\n";
  }
}
