#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  int total = (1 << n);
  vector<vector<int>> vals(n + 1);
  int x;
  for (int i = 0; i < total; i++) {
    cin >> x;
    vals[0].push_back(x);
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j < vals[i - 1].size(); j += 2) {
      if (i % 2 == 1) {
        vals[i].push_back(vals[i - 1][j] | vals[i - 1][j + 1]);
      } else {
        vals[i].push_back(vals[i - 1][j] ^ vals[i - 1][j + 1]);
      }
    }
  }
  int p, b;
  for (int t = 0; t < m; t++) {
    cin >> p >> b;
    p--;
    vals[0][p] = b;
    int pos = 2 * (p / 2);
    for (int i = 1; i <= n; i++) {
      int newVal;
      if (i % 2 == 1) {
        newVal = vals[i - 1][pos] | vals[i - 1][pos + 1];
      } else {
        newVal = vals[i - 1][pos] ^ vals[i - 1][pos + 1];
      }
      if (newVal == vals[i][pos / 2]) {
        break;
      }
      vals[i][pos / 2] = newVal;
      pos = 2 * (pos / 4);
    }
    cout << vals[n][0] << endl;
  }
  return 0;
}
