#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1);
const double eps = 1e-9;
const int inf = 2000000000;
const long long infLL = 9000000000000000000;
inline bool checkBit(long long n, int i) { return n & (1LL << i); }
inline long long setBit(long long n, int i) {
  return n | (1LL << i);
  ;
}
inline long long resetBit(long long n, int i) { return n & (~(1LL << i)); }
int dx[] = {0, 0, +1, -1};
int dy[] = {+1, -1, 0, 0};
inline bool EQ(double a, double b) { return fabs(a - b) < 1e-9; }
inline bool isLeapYear(long long year) {
  return (year % 400 == 0) || (year % 4 == 0 && year % 100 != 0);
}
inline void normal(long long &a) {
  a %= 1000000007;
  (a < 0) && (a += 1000000007);
}
inline long long modMul(long long a, long long b) {
  a %= 1000000007, b %= 1000000007;
  normal(a), normal(b);
  return (a * b) % 1000000007;
}
inline long long modAdd(long long a, long long b) {
  a %= 1000000007, b %= 1000000007;
  normal(a), normal(b);
  return (a + b) % 1000000007;
}
inline long long modSub(long long a, long long b) {
  a %= 1000000007, b %= 1000000007;
  normal(a), normal(b);
  a -= b;
  normal(a);
  return a;
}
inline long long modPow(long long b, long long p) {
  long long r = 1;
  while (p) {
    if (p & 1) r = modMul(r, b);
    b = modMul(b, b);
    p >>= 1;
  }
  return r;
}
inline long long modInverse(long long a) { return modPow(a, 1000000007 - 2); }
inline long long modDiv(long long a, long long b) {
  return modMul(a, modInverse(b));
}
struct edge {
  int u, v, w;
};
bool cmp(const edge &a, const edge &b) { return a.w < b.w; }
string to_s(int t) {
  stringstream ss;
  ss << t;
  return ss.str();
}
struct {
  int bit, status;
} t[150000 * 3];
long long a[150000], n, m;
void inti(int no, int i, int j) {
  if (i == j) {
    t[no].bit = a[i];
    t[no].status = 0;
    return;
  }
  int l = no << 1, r = l + 1, m = (i + j) >> 1;
  inti(l, i, m);
  inti(r, m + 1, j);
  if (t[l].status == 0 && t[r].status == 0) {
    t[no].bit = (t[l].bit | t[r].bit);
    t[no].status = 1;
  } else if (t[l].status == 1 && t[r].status == 1) {
    t[no].bit = (t[l].bit ^ t[r].bit);
    t[no].status = 0;
  }
}
void update(int no, int i, int j, int x, int p) {
  if (x < i || x > j) return;
  if (i == j) {
    if (i == x) {
      t[no].bit = p;
      t[no].status = 0;
      return;
    }
    return;
  }
  int l = no << 1, r = l + 1, m = (i + j) >> 1;
  update(l, i, m, x, p);
  update(r, m + 1, j, x, p);
  if (t[l].status == 0 && t[r].status == 0) {
    t[no].bit = (t[l].bit | t[r].bit);
    t[no].status = 1;
  } else if (t[l].status == 1 && t[r].status == 1) {
    t[no].bit = (t[l].bit ^ t[r].bit);
    t[no].status = 0;
  }
}
int main() {
  cin >> n >> m;
  int l = 1;
  for (int i = 0; i < n; i++) l *= 2;
  for (int i = 1; i <= l; i++) cin >> a[i];
  inti(1, 1, l);
  for (int i = 0; i < m; i++) {
    int x, y;
    cin >> x >> y;
    update(1, 1, l, x, y);
    cout << t[1].bit << '\n';
  }
}
