#include <bits/stdc++.h>
using namespace std;
struct draftTree {
  struct node {
    int value, level;
  };
  vector<node> nodes;
  vector<int> input;
  int sizeOfInput;
  int sizeOfnodes;
  void makeNode(const int &ind) {
    node *v = &nodes[ind];
    auto *val = &(v->value);
    int left = 2 * ind, right = 2 * ind + 1;
    int leftValue = nodes[left].value, rightValue = nodes[right].value;
    if (v->level % 2 == 0) {
      *val = leftValue ^ rightValue;
    } else {
      *val = leftValue | rightValue;
    }
  }
  void build(const int &ind, const int &l, const int &r) {
    node *v = &nodes[ind];
    if (l == r) {
      v->value = input[l];
      v->level = 0;
      return;
    }
    int left = 2 * ind, right = 2 * ind + 1;
    build(left, l, (l + r) / 2);
    build(right, (l + r) / 2 + 1, r);
    v->level = nodes[left].level + 1;
    makeNode(ind);
  }
  void update(const int &l, const int &b) {
    input[l] = b;
    int a = l + sizeOfInput;
    nodes[a].value = b;
    while (a) {
      a /= 2;
      makeNode(a);
    }
  }
};
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int m, power;
  draftTree tree;
  cin >> power >> m;
  tree.sizeOfInput = 1 << power;
  tree.input.resize(tree.sizeOfInput);
  tree.nodes.resize(2 * tree.sizeOfInput + 5);
  for (int i = 0; i < tree.sizeOfInput; ++i) {
    cin >> tree.input[i];
  }
  tree.build(1, 0, tree.sizeOfInput - 1);
  for (int i = 0; i < m; ++i) {
    int a, b;
    cin >> a >> b;
    --a;
    tree.update(a, b);
    cout << tree.nodes[1].value << '\n';
  }
}
