#include <bits/stdc++.h>
using namespace std;
const int maxn = 4e5 + 7;
int Data[maxn];
void build(int i, int l, int r, int n) {
  if (l == r) {
    scanf("%d", &Data[i]);
    return;
  }
  int mid = (l + r) / 2;
  build(i * 2, l, mid, n - 1);
  build(i * 2 + 1, mid + 1, r, n - 1);
  if (n & 1) {
    Data[i] = Data[i * 2] ^ Data[i * 2 + 1];
  } else {
    Data[i] = Data[i * 2] | Data[i * 2 + 1];
  }
}
void update(int i, int l, int r, int x, int val, int n) {
  if (l == r) {
    Data[i] = val;
    return;
  }
  int mid = (l + r) / 2;
  if (x <= mid) {
    update(i * 2, l, mid, x, val, n - 1);
  } else {
    update(i * 2 + 1, mid + 1, r, x, val, n - 1);
  }
  if (n & 1) {
    Data[i] = Data[i * 2] ^ Data[i * 2 + 1];
  } else {
    Data[i] = Data[i * 2] | Data[i * 2 + 1];
  }
}
int main(int argc, char *argv[]) {
  int n, m;
  cin >> n >> m;
  int len = 1 << n;
  build(1, 1, len, n + 1);
  while (m--) {
    int x, y;
    cin >> x >> y;
    update(1, 1, len, x, y, n + 1);
    cout << Data[1] << endl;
  }
  return 0;
}
