#include #include #include #include #define LL long long #define Re register int using namespace std; const int N=1e5+5; int n,x,y,T,op,A[N]; inline void in(Re &x){ Re fu=0;x=0;char ch=getchar(); while(ch<'0'||ch>'9')fu|=ch=='-',ch=getchar(); while(ch>='0'&&ch<='9')x=(x<<1)+(x<<3)+(ch^48),ch=getchar(); x=fu?-x:x; } struct Leftist_Tree{ int fa[N],pl[N],pr[N],dis[N]; inline int merge(Re x,Re y){ if(!x||!y)return x+y; if(A[x]>A[y]||(A[x]==A[y]&&x>y))swap(x,y); pr[x]=merge(pr[x],y); if(dis[pl[x]]