#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
const ll MOD = 1e+9 + 7;
int n, m, add;
int arr[500000], a[500000];
int parent(int n) { return n / 2; }
int left(int n) { return 2 * n; }
int right(int n) { return 2 * n + 1; }
void update(int n, int depth) {
  if (n == 0) return;
  if (depth & 1)
    arr[n] = arr[left(n)] | arr[right(n)];
  else
    arr[n] = arr[left(n)] ^ arr[right(n)];
  update(parent(n), depth + 1);
}
int dp(int ind, int depth) {
  if (depth == 0) return arr[ind] = a[ind - add];
  if (depth & 1)
    return arr[ind] = dp(left(ind), depth - 1) | dp(right(ind), depth - 1);
  return arr[ind] = dp(left(ind), depth - 1) ^ dp(right(ind), depth - 1);
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  cout << fixed;
  cout << setprecision(10);
  cin >> n >> m;
  add = (1 << n) - 1;
  for (int i = 1; i <= (1 << n); i++) cin >> a[i];
  dp(1, n);
  for (int i = 1; i <= m; i++) {
    int p, b;
    cin >> p >> b;
    arr[p + add] = b;
    update(parent(p + add), 1);
    cout << arr[1] << '\n';
  }
}
