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>

////////////////////////////////////////
// ポテンシャル付きUnion-Find木(未検証) //
////////////////////////////////////////

// 0-indexed
class UnionFindWithPotential {
private:
	std::vector<int> parent_, size_;
	std::vector<int64_t> potential_delta_;

	// indexの含まれる木の根のノード番号を返す
	int calcRoot(const int index)
	{
		int &parent{parent_[index]};
		if (parent == index) return index;

		const int root{calcRoot(parent)};
		potential_delta_[index] += potential_delta_[parent];
		parent = root;
		return parent;
	}
public:
	UnionFindWithPotential(const int size)
		:parent_(size), size_(size, 1), potential_delta_(size)
	{
		for (int i{}; i < size; i++) parent_[i] = i;
	}

	// index1とindex2の連結判定
	bool areConnected(const int index1, const int index2)
	{
		return calcRoot(index1) == calcRoot(index2);
	}

	// potential(index1) = potential(index2) + weightとなるよう結合
	bool unite(const int index1, const int index2, const int64_t weight)
	{
		const int root1{calcRoot(index1)}, root2{calcRoot(index2)};
		if (root1 == root2)
			return potential_delta_[index1] == potential_delta_[index2] + weight;
		if (size_[root1] <= size_[root2])
		{
			size_[root2] += size_[root1];
			potential_delta_[root1] = (potential_delta_[index2] + weight) - potential_delta_[index1];
			parent_[root1] = root2;
		}
		else
		{
			size_[root1] += size_[root2];
			potential_delta_[root2] = potential_delta_[index1] - (weight + potential_delta_[index2]);
			parent_[root2] = root1;
		}
		return true;
	}

	// indexが含まれる木の要素数を返す
	int calcSize(const int index)
	{
		return size_[calcRoot(index)];
	}

	// potential(index1) - potential(index2)を返す
	// 根が異なる場合はLLONG_MAXを返す
	int64_t calcDiff(const int index1, const int index2)
	{
		if (calcRoot(index1) != calcRoot(index2))
			return LLONG_MAX;
		return potential_delta_[index1] - potential_delta_[index2];
	}
};


int main()
{
	int n, q;
	scanf("%d%d", &n, &q);
	UnionFindWithPotential ufp(n);
	for (int q_i{}; q_i < q; q_i++)
	{
		int query, x, y;
		scanf("%d%d%d", &query, &x, &y);
		if (query == 0)
		{
			int z;
			scanf("%d", &z);
			ufp.unite(y, x, z);
		}
		else if (ufp.areConnected(x, y))
			printf("%lld\n", ufp.calcDiff(y, x));
		else
			puts("?");
	}
	return 0;
}