import sequtils,strutils,strscans,algorithm,math type unionfindtree[I : static[int]] = array[I,int] proc Init(U : var unionfindtree)= for j in 0..