#include <bits/stdc++.h>
using namespace std;
const int LN = 18;
int dp[LN][1 << LN];
int main() {
  int n, q;
  scanf("%d", &n);
  ;
  scanf("%d", &q);
  ;
  int p = 1 << n;
  for (int i = 0; i < p; i++) {
    scanf("%d", &dp[0][i]);
    ;
  }
  for (int i = 1; i < n + 1; i++) {
    p = p / 2;
    for (int j = 0; j < p; j++) {
      if (i & 1) {
        dp[i][j] = dp[i - 1][j * 2] | dp[i - 1][j * 2 + 1];
      } else {
        dp[i][j] = dp[i - 1][j * 2] ^ dp[i - 1][j * 2 + 1];
      }
    }
  }
  while (q--) {
    int pos;
    int val;
    scanf("%d", &pos);
    ;
    scanf("%d", &val);
    ;
    pos = pos - 1;
    dp[0][pos] = val;
    for (int i = 1; i <= n; i++) {
      pos /= 2;
      if (i & 1)
        dp[i][pos] = dp[i - 1][pos * 2] | dp[i - 1][pos * 2 + 1];
      else
        dp[i][pos] = dp[i - 1][pos * 2] ^ dp[i - 1][pos * 2 + 1];
    }
    printf("%d\n", dp[n][0]);
  }
  return 0;
}
