#include <bits/stdc++.h>
using namespace std;
const int mx = 1 << 18;
pair<int, int> tree[4 * mx + 1];
int arr[mx];
void construct_segment_tree(int root_index, int b, int e) {
  if (b == e) {
    tree[root_index].second = arr[b];
    tree[root_index].first = 0;
    return;
  }
  int left = root_index * 2;
  int right = (root_index * 2) + 1;
  int mid = (b + e) >> 1;
  construct_segment_tree(left, b, mid);
  construct_segment_tree(right, mid + 1, e);
  tree[root_index].first = tree[left].first + 1;
  int lev = tree[root_index].first;
  if (lev % 2 == 1)
    tree[root_index].second = (tree[left].second | tree[right].second);
  else
    tree[root_index].second = (tree[left].second ^ tree[right].second);
}
void update(int root_index, int b, int e, int i, int nwval) {
  if (i > e || i < b) {
    return;
  }
  if (i == b && i == e) {
    tree[root_index].second = nwval;
    return;
  }
  int left = (2 * root_index);
  int right = (2 * root_index) + 1;
  int mid = (b + e) >> 1;
  update(left, b, mid, i, nwval);
  update(right, mid + 1, e, i, nwval);
  int lev = tree[root_index].first;
  if (lev % 2 == 1)
    tree[root_index].second = (tree[left].second | tree[right].second);
  else
    tree[root_index].second = (tree[left].second ^ tree[right].second);
}
int main() {
  int n, q;
  scanf("%d%d", &n, &q);
  n = 1 << n;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &arr[i]);
  }
  construct_segment_tree(1, 1, n);
  int l, r;
  int c;
  while (q--) {
    scanf("%d%d", &l, &r);
    update(1, 1, n, l, r);
    printf("%d\n", tree[1].second);
  }
}
