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 <iostream>
using namespace std;

#include <vector>
template<class T>struct UnionFind {
  vector<int> parent, sz;
  vector<T> _diff;
  UnionFind(int n) {
    parent.resize(n, -1);
    sz.resize(n, 1);
    _diff.resize(n, 0); // 親との差
  }
  int root(int x) {
    if (parent[x] == -1)
      return x;
    int r = root(parent[x]);
    _diff[x] += _diff[parent[x]];
    return parent[x] = r;
  }
  T weight(int x) {
    root(x);
    return _diff[x];
  }
  void merge(int x, int y, T w) {
    // weight(x) = weight(y) + w;
    // yが親
    if (root(x) == root(y))
      return;
    T d = weight(y) - weight(x) + w;
    x = root(x); y = root(y);
    parent[x] = y;
    sz[y] += sz[x];
    _diff[x] = d;
    return;
  }
  T diff(int x, int y) {
    return weight(y) - weight(x);
  }
  bool same(int x, int y) {
    return root(x) == root(y);
  }
  int size(int x) {
    return sz[root(x)];
  }
};

#define in(v) v; cin >> v;
void ins() {}
template<class T,class... Rest>void ins(T& v,Rest&... rest){cin>>v;ins(rest...);}
#define rep(i,n) for(int i=0,_i=(n);i<_i;++i)

int main() {
  int n, q; cin >> n >> q;
  UnionFind<int> T(n);

  rep(i, q) {
    int com, x, y;
    ins(com, x, y);
    if (com == 0) {
      int in(z);
      T.merge(y, x, z);
    } else if (com == 1) {
      if (T.same(x, y))
        cout << T.diff(x, y) << endl;
      else
        cout << "?" << endl;
    }
  }
  return 0;
}