#include <bits/stdc++.h>
using namespace std;
int n, k, q;
int t[18][131073];
int fix() {}
int main() {
  scanf("%d%d", &n, &q);
  k = round(pow(2, n));
  for (int j = 1; j <= k; ++j) scanf("%d", &t[0][j]);
  for (int i = 1; i <= n; ++i) {
    k /= 2;
    for (int j = 1; j <= k; ++j) {
      if (i % 2 == 1)
        t[i][j] = t[i - 1][2 * j - 1] | t[i - 1][2 * j];
      else
        t[i][j] = t[i - 1][2 * j - 1] ^ t[i - 1][2 * j];
    }
  }
  for (int iq = 1; iq <= q; ++iq) {
    int p, b;
    scanf("%d%d", &p, &b);
    t[0][p] = b;
    for (int i = 1; i <= n; ++i) {
      p = (p + 1) / 2;
      if (i % 2 == 1)
        t[i][p] = t[i - 1][2 * p - 1] | t[i - 1][2 * p];
      else
        t[i][p] = t[i - 1][2 * p - 1] ^ t[i - 1][2 * p];
    }
    printf("%d\n", t[n][1]);
  }
  return 0;
}
