#include <bits/stdc++.h>
struct st {
  void init(std::vector<int32_t> &a) {
    int32_t sz = 1;
    while (sz < a.size()) sz *= 2;
    tree.resize(2 * sz - 1, 0);
    level.resize(2 * sz - 1, 0);
    size = sz;
    build(0, 0, size, a);
  }
  void set(int32_t ind, int32_t val) { set(0, 0, size, ind, val); }
  int32_t get() { return tree[0]; }

 private:
  std::vector<int32_t> tree;
  std::vector<int32_t> level;
  int32_t size;
  int32_t ls(int32_t v) { return 2 * v + 1; }
  int32_t rs(int32_t v) { return 2 * v + 2; }
  int32_t compose(int32_t a, int32_t b, int32_t &lvl) {
    if (lvl % 2 == 0) {
      return a ^ b;
    } else {
      return a | b;
    }
  }
  void build(int32_t v, int32_t tl, int32_t tr, std::vector<int32_t> &a) {
    if (tl + 1 == tr) {
      level[v] = 0;
      if (tl < a.size()) {
        tree[v] = a[tl];
      }
    } else {
      int32_t tm = (tl + tr) / 2;
      build(ls(v), tl, tm, a);
      build(rs(v), tm, tr, a);
      level[v] = level[ls(v)] + 1;
      tree[v] = compose(tree[ls(v)], tree[rs(v)], level[v]);
    }
  }
  void set(int32_t v, int32_t tl, int32_t tr, int32_t &i, int32_t &val) {
    if (tl + 1 == tr) {
      tree[v] = val;
    } else {
      int32_t tm = (tl + tr) / 2;
      if (i < tm) {
        set(ls(v), tl, tm, i, val);
      } else {
        set(rs(v), tm, tr, i, val);
      }
      tree[v] = compose(tree[ls(v)], tree[rs(v)], level[v]);
    }
  }
};
void solve() {
  int32_t n, m;
  std::cin >> n >> m;
  n = 1 << n;
  std::vector<int32_t> a(n);
  for (int32_t i = 0; i < n; ++i) std::cin >> a[i];
  st t;
  t.init(a);
  for (int32_t i = 0; i < m; ++i) {
    int32_t p, b;
    std::cin >> p >> b;
    t.set(--p, b);
    std::cout << t.get() << '\n';
  }
}
int32_t main() { solve(); }
