#include <bits/stdc++.h>   int q, t, l, r, x, last;   std::map<int, int> dsu, val;   int root(int x) {     int cur = dsu[x];     if (cur < 0)       return x;     else {       dsu[x] = root(dsu[x]);       val[x] ^= val[cur];       return dsu[x];     }   }   void connect(int x, int y, int v) {     int a = root(x), b = root(y);     if (a != b) {       if (dsu[a] > dsu[b]) std::swap(a, b);       dsu[a] += dsu[b];       dsu[b] = a;       val[b] = v ^ val[x] ^ val[y];     }   }   int main() {     std::cin >> q;     while (q--) {       std::cin >> t >> l >> r;       if ((l ^= last) > (r ^= last)) std::swap(l, r);       if (!dsu.count(l)) dsu[l] = -1;       if (!dsu.count(++r)) dsu[r] = -1;       if (t == 1) {         std::cin >> x;         connect(l, r, x ^= last);       } else if (root(l) == root(r))         std::cout << (last = val[l] ^ val[r]) <<   n ;       else         std::cout << -(last = 1) <<   n ;     }   }   