#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  vector<vector<int> > vect(n + 1);
  for (int i = 0; i < pow(2, n); i++) {
    int a;
    cin >> a;
    vect[0].push_back(a);
  }
  bool and_operation = true;
  for (int i = 1; i <= n; i++) {
    if (and_operation) {
      for (int j = 0; j < vect[i - 1].size(); j += 2) {
        vect[i].push_back(vect[i - 1][j] | vect[i - 1][j + 1]);
      }
      and_operation = false;
    } else {
      for (int j = 0; j < vect[i - 1].size(); j += 2) {
        vect[i].push_back(vect[i - 1][j] ^ vect[i - 1][j + 1]);
      }
      and_operation = true;
    }
  }
  for (int i = 0; i < m; i++) {
    int pos, value;
    cin >> pos >> value;
    pos--;
    vect[0][pos] = value;
    bool and_operation = true;
    for (int j = 1; j < vect.size(); j++) {
      int next;
      if (pos % 2 == 0)
        next = pos + 1;
      else
        next = pos - 1;
      if (and_operation) {
        vect[j][pos / 2] = vect[j - 1][pos] | vect[j - 1][next];
        and_operation = false;
      } else {
        vect[j][pos / 2] = vect[j - 1][pos] ^ vect[j - 1][next];
        and_operation = true;
      }
      pos = pos / 2;
    }
    cout << vect[n][0] << endl;
  }
  return 0;
}
