#include <bits/stdc++.h>
using namespace std;
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << " : " << arg1 << " | ";
  __f(comma + 1, args...);
}
const long long int MOD = 1000000007;
inline void add(long long int& x, long long int y) {
  x += y;
  if (x >= MOD) x -= MOD;
  if (x < 0) x += MOD;
}
inline long long int mul(long long int x, long long int y) {
  return ((long long int)x * y) % MOD;
}
long long int gcd(long long int a, long long int b) {
  if (b) return gcd(b, a % b);
  return a;
}
long long int power(long long int a, long long int p) {
  long long int ret = 1;
  while (p) {
    if (p & 1) ret = mul(ret, a);
    a = mul(a, a);
    p /= 2;
  }
  return ret;
}
long long int phi(long long int n) {
  long long int ret = n;
  long long int i = 2;
  if (n % i == 0) {
    ret -= ret / i;
    while (n % i == 0) n /= i;
  }
  for (i = 3; i * i <= n; i++)
    if (n % i == 0) {
      ret -= ret / i;
      while (n % i == 0) n /= i;
    }
  if (n > 1) ret -= ret / n;
  return ret;
}
long long int n, m;
long long int a[200005];
long long int tree[200005];
void update(long long int p, long long int q) {
  p--;
  tree[(1 << (n)) + p] = q;
  long long int flag = 1;
  for (long long int i = ((1 << (n)) + p) / 2; i > 0; i /= 2) {
    if (flag == 1)
      tree[i] = tree[2 * i] | tree[2 * i + 1];
    else
      tree[i] = tree[2 * i] ^ tree[2 * i + 1];
    flag = 1 - flag;
  }
  return;
}
void make(long long int x, long long int flag) {
  if (x == 0) return;
  long long int fi = 1 << (x), li = 1 << (x + 1);
  if (x == n) {
    for (long long int i = fi; i < li; i++) {
      tree[i] = a[i - fi];
    }
    make(x - 1, 1);
  } else {
    for (long long int i = fi; i < li; i++) {
      if (flag == 1)
        tree[i] = tree[2 * i] | tree[2 * i + 1];
      else
        tree[i] = tree[2 * i] ^ tree[2 * i + 1];
    }
    make(x - 1, 1 - flag);
  }
  return;
}
int main() {
  memset(a, 0, sizeof(a));
  cin >> n >> m;
  for (long long int i = 0; i < 1 << n; i++) {
    ;
    scanf("%lld", &a[i]);
    ;
  }
  make(n, 0);
  long long int p, q;
  for (long long int i = 0; i < m; i++) {
    ;
    scanf("%lld", &p);
    ;
    ;
    scanf("%lld", &q);
    ;
    update(p, q);
    ;
    printf("%lld\n", tree[1]);
    ;
  }
  return 0;
}
