#include <bits/stdc++.h>
using namespace std;
long long n, m, k;
long long a, b, c;
long long x, y;
long long entry;
string str;
vector<long long> tree[20];
void run() {
  cin >> n >> m;
  for (long long int i = 0; i < pow(2, n); i++) {
    cin >> entry;
    tree[0].push_back(entry);
  }
  for (long long int i = 1; i < 20; i++) {
    if (tree[i - 1].size() == 1) {
      break;
    }
    for (long long int j = 0; j < tree[i - 1].size(); j++) {
      if (i % 2 == 1) {
        entry = tree[i - 1][j] | tree[i - 1][j + 1];
      } else {
        entry = tree[i - 1][j] ^ tree[i - 1][j + 1];
      }
      j++;
      tree[i].push_back(entry);
    }
  }
  for (long long int w = 0; w < m; w++) {
    cin >> a >> b;
    a--;
    tree[0][a] = b;
    for (long long int i = 1; i < 20; i++) {
      if (tree[i - 1].size() == 1) {
        break;
      }
      if (a % 2 == 1) {
        a--;
      }
      if (i % 2 == 1) {
        entry = tree[i - 1][a] | tree[i - 1][a + 1];
      } else {
        entry = tree[i - 1][a] ^ tree[i - 1][a + 1];
      }
      a /= 2;
      tree[i][a] = entry;
    }
    cout << setprecision(20) << tree[n][0] << '\n';
    ;
  }
}
void setup() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
}
int main() {
  setup();
  int tests = 1;
  for (int i = 0; i < tests; i++) {
    run();
  }
  return 0;
}
