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 <iomanip>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <utility>
#include <string>
#include <cmath>
#include <cstdlib>
#include <cstring>

using namespace std;

typedef uint64_t u64;
typedef int64_t s64;
typedef uint32_t u32;
typedef int32_t s32;
typedef vector<s32> vs32;
typedef vector<u32> vu32;
typedef vector<s64> vs64;
typedef vector<u64> vu64;

const double PI=3.14159265358979323846;

#define MAX(x, y) ((x) < (y) ? (y) : (x))
#define MIN(x, y) ((x) > (y) ? (y) : (x))

#define rep(i, N) for(int i = 0; i < N; ++i)

#define CEIL(x, y) (((x) + (y) - 1) / (y))
#define MOD 1000000007ULL

class DisjointSet
{
public:
    DisjointSet() {}
    DisjointSet(int n)
    : p(vs32(n, -1)), w(vs32(n, 0))
    {}
    ~DisjointSet() {}

    bool same(int x, int y)
    {
        x = parent(x);
        y = parent(y);
        return x == y;
    }

    int diff(int x, int y)
    {
        parent(x); parent(y);
        return w[y] - w[x];
    }

    void unite(int x, int y, int d)
    {
        int rx = parent(x);
        int ry = parent(y);

        if (rx == ry) return;

        if (p[rx] > p[ry])
        {
            swap(rx, ry);
            swap(x, y);
            d = -d;
        }
        p[rx] += p[ry];
        p[ry] = rx;
        w[ry] = w[x] + d - w[y];
    }

    int parent(int x)
    {
        int ret;
        if (p[x] < 0)
        {
            ret = x;
        }
        else
        {
            ret = parent(p[x]);
            w[x] += w[p[x]];
            p[x] = ret;
        }
        return ret;
    }

    vs32 p;
    vs32 w;
};

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n, q;
    cin >> n >> q;

    DisjointSet ds(n);
    char com;
    int x, y, d;
    rep (i, q)
    {
        cin >> com;
        if (com == '0')
        {
            cin >> x >> y >> d;
            ds.unite(x, y, d);
        }
        else if (com == '1')
        {
            cin >> x >> y;
            if (!ds.same(x, y))
            {
                cout << "?\n";
            }
            else
            {
                cout << ds.diff(x, y) << "\n";
            }
        }
    }

    return 0;
}