if (M == 1)
{
cin >> x >> y >> z;
if (x > y) swap(x, y);
Link(Node[x], Node[N + eid]);
Link(Node[N + eid], Node[y]);
edge[{x, y}] = eid;
node* n = Path(Node[N + eid], Node[N + eid]);
n->Push();
n->lazy = z;
n->Push();
++eid;
}
else if (M == 2)
{
cin >> x >> y;
if (x > y) swap(x, y);
node* n = Lca(Node[x], Node[N + edge[{x, y}]]);
if (n == Node[x]) Cut(Node[N + edge[{x, y}]]);
else Cut(Node[x]);
node* l = Lca(Node[y], Node[N + edge[{x, y}]]);
if (l == Node[y]) Cut(Node[N + edge[{x, y}]]);
else Cut(Node[y]);
}