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 <vector>
#include <climits>

struct weighted_union_find {
	long long N;					// the number of nodes
	long long M;					// the number of trees
	std::vector<long long> parent;	// parent[i] := the direct parent of i
	std::vector<long long> size;	// size[i] := the number of nodes in the tree containing i
	std::vector<long long> weight;	// weight[i] := the weight of the edge from i to parent[i]

	weighted_union_find(long long n) : N(n), M(n) {
		parent.resize(n, -1);
		size.resize(n, 1);
		weight.resize(n, 0);
	}

	long long weight_sum_to_root(long long i) {
		if (parent[i] == -1) return 0;
		else return weight[i] + weight_sum_to_root(parent[i]);
	}

	long long root(long long i) {
		if (parent[i] == -1) return i;
		long long x = root(parent[i]);
		weight[i] += weight[parent[i]];
		return parent[i] = x;
	}

	bool is_united(long long i, long long j) {
		return (root(i) == root(j));
	}

	long long dist(long long i, long long j) {
		if (!is_united(i, j)) return LLONG_MAX;
		else return weight_sum_to_root(j) - weight_sum_to_root(i);
	}

	// false : detected confliction
	bool unite(long long i, long long j, long long w) {
		w += weight_sum_to_root(i) - weight_sum_to_root(j);
		i = root(i); j = root(j);
		if (i == j) return (w == 0);
		if (size[i] < size[j]) {
			std::swap(i, j);
			w *= -1;
		}
		parent[j] = i;
		size[i] += size[j];
		weight[j] = w;
		return true;
	}
};

int main() {
	long long n, q;
	std::cin >> n >> q;
	weighted_union_find uf(n);
	while (q--) {
		long long w, x, y;
		std::cin >> w >> x >> y;
		if (w == 0) {
			long long z;
			std::cin >> z;
			uf.unite(x, y, z);
		} else {
			long long d = uf.dist(x, y);
			if (d == LLONG_MAX) std::cout << "?\n";
			else std::cout << d << '\n';
		}
	}
}