#include <bits/stdc++.h> using namespace std; int fa[100005], lc[100005], rc[100005], a[100005], h[100005]; int n, m; int find(int x) { if(fa[x] != x) fa[x] = find(fa[x]); return fa[x]; } int mergex(int x, int y) { if(!x || !y) return x | y; if(a[x] > a[y]) swap(x, y); if(x > y &&...