Problem: There is a sequence $A = a_0, a_1, ..., a_{n-1}$. You are given the following information and questions.

* relate$(x, y, z)$: $a_y$ is greater than $a_x$ by $z$
* diff$(x, y)$: report the difference between $a_x$ and $a_y$ $(a_y - a_x)$

Constraints

* $2 \leq n \leq 100,000$
* $1 \leq q \leq 200,000$
* $0 \leq x, y < n$
* $x \ne y$
* $0 \leq z \leq 10000$
* There are no inconsistency in the given information

Input


$n \; q$
$query_1$
$query_2$
:
$query_q$


In the first line, $n$ and $q$ are given. Then, $q$ information/questions are given in the following format.


0 $x \; y\; z$


or


1 $x \; y$


where '0' of the first digit denotes the relate information and '1' denotes the diff question.

Output

For each diff question, print the difference between $a_x$ and $a_y$ $(a_y - a_x)$.

Example

Input

5 6
0 0 2 5
0 1 2 3
1 0 1
1 1 3
0 1 4 8
1 0 4


Output

2
?
10

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
#define int long long
#define pii pair<int,int>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(c) (c).begin(),(c).end()
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define MINF(a) memset(a,0x3f,sizeof(a))
#define POW(n) (1LL<<(n))
#define IN(i,a,b) (a <= i && i <= b)
using namespace std;
template <typename T> inline bool CHMIN(T& a,T b) { if(a>b) { a=b; return 1; } return 0; }
template <typename T> inline bool CHMAX(T& a,T b) { if(a<b) { a=b; return 1; } return 0; }
template <typename T> inline void SORT(T& a) { sort(ALL(a)); }
template <typename T> inline void REV(T& a) { reverse(ALL(a)); }
template <typename T> inline void UNI(T& a) { sort(ALL(a)); a.erase(unique(ALL(a)),a.end()); }
const int MOD = 1000000007;
const int INF = 0x3f3f3f3f3f3f3f3f;
const double EPS = 1e-10;
/* ---------------------------------------------------------------------------------------------------- */

template <typename T>
struct WUF {
  int n, c;
  vector<int> p;
  vector<T> dw;
  WUF() {}
  WUF(int n) : n(n), c(n), p(n, -1), dw(n) {}
  int find(int x) {
    if (p[x] < 0) return x;
    int r = find(p[x]);
    dw[x] += dw[p[x]];
    return p[x] = r;
  }
  int unite(int x, int y, T w) {
    w += weight(x); w -= weight(y);
    x = find(x); y = find(y);
    if (x == y) return w == 0;
    if (p[x] > p[y]) swap(x,y), w = -w;
    p[x] += p[y];
    p[y] = x;
    dw[y] = w;
    c--;
    return 1;
  }
  T weight(int x) {
    find(x);
    return dw[x];
  }
  T diff(int x, int y) {
    assert(same(x, y));
    return weight(y) - weight(x);
  }
  bool same(int x, int y) {
    return find(x) == find(y);
  }
  int size(int x) {
    return -p[find(x)];
  }
  int count() {
    return c;
  }
};

signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);

  int n,q;
  cin >> n >> q;
  WUF<int> wuf(n);
  REP(i,q) {
    int c;
    cin >> c;
    if (c == 0) {
      int x,y,z;
      cin >> x >> y >> z;
      wuf.unite(x,y,z);
    } else {
      int x,y;
      cin >> x >> y;
      if (wuf.same(x,y)) cout << wuf.diff(x,y) << endl;
      else cout << "?" << endl;
    }
  }

  return 0;
}