There is an array a of 2^{30} integers, indexed from 0 to 2^{30}-1. Initially, you know that 0 ≤ a_i < 2^{30} (0 ≤ i < 2^{30}), but you do not know any of the values. Your task is to process queries of two types:

  * 1 l r x: You are informed that the bitwise xor of the subarray [l, r] (ends inclusive) is equal to x. That is, a_l ⊕ a_{l+1} ⊕ … ⊕ a_{r-1} ⊕ a_r = x, where ⊕ is the bitwise xor operator. In some cases, the received update contradicts past updates. In this case, you should ignore the contradicting update (the current update).
  * 2 l r: You are asked to output the bitwise xor of the subarray [l, r] (ends inclusive). If it is still impossible to know this value, considering all past updates, then output -1.



Note that the queries are encoded. That is, you need to write an online solution.

Input

The first line contains a single integer q (1 ≤ q ≤ 2 ⋅ 10^5) — the number of queries.

Each of the next q lines describes a query. It contains one integer t (1 ≤ t ≤ 2) — the type of query.

The given queries will be encoded in the following way: let last be the answer to the last query of the second type that you have answered (initially, last = 0). If the last answer was -1, set last = 1.

  * If t = 1, three integers follow, l', r', and x' (0 ≤ l', r', x' < 2^{30}), meaning that you got an update. First, do the following: l = l' ⊕ last, r = r' ⊕ last, x = x' ⊕ last 

and, if l > r, swap l and r.

This means you got an update that the bitwise xor of the subarray [l, r] is equal to x (notice that you need to ignore updates that contradict previous updates).

  * If t = 2, two integers follow, l' and r' (0 ≤ l', r' < 2^{30}), meaning that you got a query. First, do the following: l = l' ⊕ last, r = r' ⊕ last 

and, if l > r, swap l and r.

For the given query, you need to print the bitwise xor of the subarray [l, r]. If it is impossible to know, print -1. Don't forget to change the value of last.




It is guaranteed there will be at least one query of the second type.

Output

After every query of the second type, output the bitwise xor of the given subarray or -1 if it is still impossible to know.

Examples

Input

12
2 1 2
2 1 1073741822
1 0 3 4
2 0 0
2 3 3
2 0 3
1 6 7 3
2 4 4
1 0 2 1
2 0 0
2 4 4
2 0 0


Output

-1
-1
-1
-1
5
-1
6
3
5


Input

4
1 5 5 9
1 6 6 5
1 6 5 10
2 6 5


Output

12

Note

In the first example, the real queries (without being encoded) are:

  * 12
  * 2 1 2
  * 2 0 1073741823
  * 1 1 2 5
  * 2 1 1
  * 2 2 2
  * 2 1 2
  * 1 2 3 6
  * 2 1 1
  * 1 1 3 0
  * 2 1 1
  * 2 2 2
  * 2 3 3


  * The answers for the first two queries are -1 because we don't have any such information on the array initially. 
  * The first update tells us a_1 ⊕ a_2 = 5. Note that we still can't be certain about the values a_1 or a_2 independently (for example, it could be that a_1 = 1, a_2 = 4, and also a_1 = 3, a_2 = 6). 
  * After we receive all three updates, we have enough information to deduce a_1, a_2, a_3 independently. 



In the second example, notice that after the first two updates we already know that a_5 ⊕ a_6 = 12, so the third update is contradicting, and we ignore it.
#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
template <class c>
struct rge {
  c h, n;
};
template <class c>
rge<c> range(c h, c n) {
  return rge<c>{h, n};
}
template <class c, class F>
struct rgm {
  c h, n;
  F f;
};
template <class c, class F>
rgm<c, F> map_range(c b, c e, F f) {
  return rgm<c, F>{b, e, f};
}
template <class c, class F>
rgm<typename c::const_iterator, F> map_range(const c &x, F f) {
  return map_range(x.begin(), x.end(), f);
}
template <class c>
auto dud(c *r) -> decltype(cerr << *r);
template <class c>
char dud(...);
struct muu {
  template <class c>
  muu &operator<<(const c &) {
    return *this;
  }
  muu &operator()() { return *this; }
};
const int nax = 2e5 + 44;
template <class c, class n>
using used_map = map<c, n>;
used_map<int, int> u;
used_map<int, vector<int> > un;
used_map<int, int> val;
used_map<int, int> size;
void touch(int x) {
  if (u.count(x) == 0) {
    u[x] = x;
    size[x] = 1;
  }
}
int find(int x) {
  if (u[x] == x) return x;
  return u[x] = find(u[x]);
}
void flip(int x, int c) {
  (muu() << __FUNCTION__ << "#" << 76 << ": ") << "["
                                                  "val"
                                                  "["
                                                  "x"
                                                  ": "
                                               << (x)
                                               << "] "
                                                  ": "
                                               << val[x] << "] "
                                               << "^= "
                                               << "["
                                                  "c"
                                                  ": "
                                               << (c) << "] ";
  val[x] ^= c;
  for (int y : un[x]) flip(y, c);
}
void onion(int aa, int bb, int c) {
  int a = find(aa);
  int b = find(bb);
  (muu() << __FUNCTION__ << "#" << 83 << ": ") << "["
                                                  "a"
                                                  ": "
                                               << (a)
                                               << "] "
                                                  "["
                                                  "b"
                                                  ": "
                                               << (b)
                                               << "] "
                                                  "["
                                                  "aa"
                                                  ": "
                                               << (aa)
                                               << "] "
                                                  "["
                                                  "bb"
                                                  ": "
                                               << (bb) << "] ";
  if (a == b) {
    if ((val[aa] ^ val[bb]) != c)
      (muu() << __FUNCTION__ << "#" << 88 << ": ") << "["
                                                      "val"
                                                      "["
                                                      "a"
                                                      ": "
                                                   << (a)
                                                   << "] "
                                                      ": "
                                                   << val[a]
                                                   << "] "
                                                      "["
                                                      "val"
                                                      "["
                                                      "b"
                                                      ": "
                                                   << (b)
                                                   << "] "
                                                      ": "
                                                   << val[b]
                                                   << "] "
                                                      "["
                                                      "c"
                                                      ": "
                                                   << (c)
                                                   << "] "
                                                      " contradiction";
    return;
  }
  if (size[a] > size[b]) swap(a, b);
  flip(a, val[aa] ^ val[bb] ^ c);
  size[b] += size[a];
  un[b].push_back(a);
  u[a] = b;
}
int main() {
  int q;
  scanf("%d", &q);
  int last = 0;
  for (int _ = 0; _ < q; ++_) {
    int t;
    scanf("%d", &t);
    if (t == 1) {
      int l, r, x;
      scanf("%d%d%d", &l, &r, &x);
      l ^= last;
      r ^= last;
      x ^= last;
      if (l > r) swap(l, r);
      (muu() << __FUNCTION__ << "#" << 111 << ": ") << "decoded info: "
                                                       "["
                                                       "l"
                                                       ": "
                                                    << (l)
                                                    << "] "
                                                       "["
                                                       "r"
                                                       ": "
                                                    << (r)
                                                    << "] "
                                                       "["
                                                       "x"
                                                       ": "
                                                    << (x) << "] ";
      r++;
      touch(l);
      touch(r);
      onion(l, r, x);
    } else {
      int l, r;
      scanf("%d%d", &l, &r);
      l ^= last;
      r ^= last;
      if (l > r) swap(l, r);
      (muu() << __FUNCTION__ << "#" << 123 << ": ") << "decoded ask: "
                                                       "["
                                                       "l"
                                                       ": "
                                                    << (l)
                                                    << "] "
                                                       "["
                                                       "r"
                                                       ": "
                                                    << (r) << "] ";
      r++;
      if (u.count(l) && u.count(r) && find(l) == find(r)) {
        last = val[l] ^ val[r];
        printf("%d\n", last);
      } else {
        printf("-1\n");
        last = 1;
      }
    }
    (muu() << __FUNCTION__ << "#" << 134 << ": ") << "["
                                                     "u"
                                                     ": "
                                                  << (u) << "] ";
    (muu() << __FUNCTION__ << "#" << 135 << ": ") << "["
                                                     "val"
                                                     ": "
                                                  << (val) << "] ";
  }
}
