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>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>

using namespace std;
typedef pair<long long int, long long int> P;

long long int INF = 1e18;

#define MAX_N 110000

int par1[MAX_N], par2[MAX_N];
int rnk1[MAX_N], rnk2[MAX_N];
long long int diff1[MAX_N], diff2[MAX_N];

// 初期化
void init(int n, int par[], int rnk[], long long int diff[]){
	for(int i = 0; i < n; i++){
		par[i] = i;
		rnk[i] = 0;
		diff[i] = 0;
	}
}

// x の親を返す
P find(int x, int par[], long long int diff[]){
	P p;
	if(par[x] == x){
		p.first = x;
		p.second = 0;
		return p;
	}
	p = find(par[x], par, diff);
	diff[x] += p.second;
	p.second = diff[x];
	par[x] = p.first;
	return p;
}

// x と y を併合する
bool unite(int x, int y, int z, int par[], int rnk[], long long int diff[]){
	P px = find(x, par, diff);
	P py = find(y, par, diff);
	int x_par = px.first;
	int y_par = py.first;
	if(x_par == y_par){
    if(px.second != py.second + z){
      return false;
    }
		return true;
	}

	if(rnk[x_par] < rnk[y_par]){
		par[x_par] = y_par;
		diff[x_par] = diff[y_par] - px.second + py.second + z;
	}else{
		par[y_par] = x_par;
		diff[y_par] = diff[x_par] + px.second - py.second - z;
		if(rnk[x_par] == rnk[y_par]){
			rnk[x_par]++;
		}
	}
  return true;
}

// x, y が同じグループか判定
bool same(int x, int y, int par[], long long int diff[]){
	P px = find(x, par, diff);
	P py = find(y, par, diff);
	int x_par = px.first;
	int y_par = py.first;
	return (x_par == y_par);
}

int main(){
  init(MAX_N, par1, rnk1, diff1);
  init(MAX_N, par2, rnk2, diff2);
  int n, q;
  cin >> n >> q;
  for(int loop = 0; loop < q; loop++){
    int tp;
    cin >> tp;
    if(tp == 0){
      long long int x, y, z;
      cin >> x >> y >> z;
      bool ret = unite(x, y, z, par1, rnk1, diff1);
      if(!ret){
        return 0;
      }
    }else{
      long long int x, y;
      cin >> x >> y;
      if(same(x, y, par1, diff1)){
        cout << diff1[x] - diff1[y] << endl;
      }else{
        cout << "?" << endl;
      }
    }
  }
  return 0;
}