#include <bits/stdc++.h>
using namespace std;
long long int mypow(long long int a, long long int b) {
  long long int res = 1LL;
  while (b) {
    if (b & 1) res = res * a % 1000000007;
    a = a * a % 1000000007;
    b >>= 1;
  }
  return res;
}
long long int A[131072];
long long int sg[4 * 131072];
int makesg(int st, int en, int i) {
  if (st == en) {
    sg[i] = A[st];
    return 1;
  }
  int md = (st + en) / 2;
  int l = makesg(st, md, 2 * i + 1);
  int r = makesg(md + 1, en, 2 * i + 2);
  if (l == 1) {
    sg[i] = sg[2 * i + 1] | sg[2 * i + 2];
    return 2;
  } else {
    sg[i] = sg[2 * i + 1] ^ sg[2 * i + 2];
    return 1;
  }
}
int update(int st, int en, int in, int vl, int i) {
  if (in < st || in > en) {
    return 0;
  }
  if (st == en) {
    sg[i] = vl;
    return 1;
  }
  int md = (st + en) / 2;
  int l = update(st, md, in, vl, 2 * i + 1);
  int r = update(md + 1, en, in, vl, 2 * i + 2);
  if (l == 1 || r == 1) {
    sg[i] = sg[2 * i + 1] | sg[2 * i + 2];
    return 2;
  }
  if (l == 2 || r == 2) {
    sg[i] = sg[2 * i + 1] ^ sg[2 * i + 2];
    return 1;
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int t = 1;
  while (t--) {
    int n, m;
    cin >> n >> m;
    n = pow(2, n);
    for (int i = 0; i < n; i++) {
      cin >> A[i];
    }
    makesg(0, n - 1, 0);
    while (m--) {
      int p, b;
      cin >> p >> b;
      p--;
      update(0, n - 1, p, b, 0);
      cout << sg[0] << endl;
    }
  }
  return 0;
}
