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 rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<long long> vl;
#define INF __INT32_MAX__
#define LINF __LONG_LONG_MAX__

class UnionFind
{
    private:
        vl parents;
        vl rank;
        vl diff_weight;

    public:
        UnionFind(ll n) {
            for (ll i = 0; i < n; i++) {
                parents.push_back(i);
            }
            rank.resize(n, 1);
            diff_weight.resize(n, 0);
        }

        ll weight(ll a) {
            root(a);
            return diff_weight[a];
        }

        ll diff(ll a, ll b) {
            return diff_weight[a] - diff_weight[b];
        }

        ll root(ll a) {
            if (parents[a] == a) return a;
            ll r = root(parents[a]);

            diff_weight[a] += diff_weight[parents[a]];
            parents[a] = r;
            return r;
        }

        ll same(ll a, ll b) {
            return root(a) == root(b);
        }

        bool unite(ll a, ll b, ll d) {
            ll ra = root(a);
            ll rb = root(b);
            if (ra == rb) return false;

            if (rank[ra] < rank[rb]) {
                rank[rb] += rank[ra];
                diff_weight[ra] = d - diff_weight[a] + diff_weight[b];
                parents[ra] = rb;
            } else {
                rank[ra] += rank[rb];
                diff_weight[rb] = diff_weight[a] - diff_weight[b] - d;
                parents[rb] = ra;
            }
            return false;
        }
};

int main() {
    int N, Q;
    cin >> N >> Q;
    UnionFind uni(N);
    rep(i, Q) {
        int C, X, Y, Z;
        cin >> C;
        if (C == 0) {
            cin >> X >> Y >> Z;
            uni.unite(X, Y, Z);
        } else {
            cin >> X >> Y;
            if (uni.same(X, Y)) {
                cout << (uni.diff(X, Y)) << endl;
            } else {
                cout << '?' << endl;
            }
        }
    }
}