#include <bits/stdc++.h>
using namespace std;
const int N = 131072 * 4;
vector<long long> dp(N, 0);
int build(long long a[], int v, int l, int r) {
  if (l > r) return 0;
  if (l == r) {
    dp[v] = a[r];
    return 0;
  }
  int mid = ((l + r) / 2), flag;
  flag = build(a, 2 * v, l, mid);
  flag = build(a, 2 * v + 1, mid + 1, r);
  if (flag == 0)
    dp[v] = dp[v * 2] | dp[v * 2 + 1];
  else
    dp[v] = dp[v * 2] ^ dp[v * 2 + 1];
  return 1 - flag;
}
int update(int v, int el, int l, int r, int p) {
  if (l > r) return 0;
  if (l == r) {
    if (l == p) dp[v] = el;
    return 0;
  }
  int mid = (l + r) / 2, flag;
  if (p > mid)
    flag = update(2 * v + 1, el, mid + 1, r, p);
  else
    flag = update(2 * v, el, l, mid, p);
  if (flag == 0)
    dp[v] = dp[v * 2 + 1] | dp[v * 2];
  else
    dp[v] = dp[v * 2 + 1] ^ dp[v * 2];
  return 1 - flag;
}
int main() {
  int n, m, p;
  cin >> n >> m;
  int tmp = (int)pow(2.0, (double)n);
  long long a[tmp], elm;
  for (int i = 0; i < tmp; i++) cin >> a[i];
  build(a, 1, 0, tmp - 1);
  for (int i = 0; i < m; i++) {
    cin >> p >> elm;
    update(1, elm, 0, tmp - 1, p - 1);
    cout << dp[1] << endl;
  }
  return 0;
}
