#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 5;
int dp[19][N];
int main() {
  int n, q;
  scanf("%d", &n);
  ;
  scanf("%d", &q);
  ;
  int p = 1 << n;
  for (int i = 0; i < p; i++) {
    cin >> dp[0][i];
  }
  for (int i = 1; i <= n; i++) {
    int k = 1 << (n - i);
    for (int j = 0; j < k; j++) {
      if (i % 2 == 0) {
        dp[i][j] = dp[i - 1][2 * j] ^ dp[i - 1][2 * j + 1];
      } else {
        dp[i][j] = dp[i - 1][2 * j] | dp[i - 1][2 * j + 1];
      }
    }
  }
  while (q--) {
    int pos, val;
    scanf("%d", &pos);
    ;
    scanf("%d", &val);
    ;
    pos--;
    dp[0][pos] = val;
    for (int i = 1; i <= n; i++) {
      int cur = pos >> i;
      if (i % 2 == 0) {
        dp[i][cur] = dp[i - 1][cur * 2] ^ dp[i - 1][cur * 2 + 1];
      } else {
        dp[i][cur] = (dp[i - 1][cur * 2]) | (dp[i - 1][cur * 2 + 1]);
      }
    }
    cout << dp[n][0] << endl;
  }
  return 0;
}
