import sequtils,strutils,math type unionfindtree[I : static[int]] = array[I,int] proc find(U : unionfindtree; a : int, b :int): bool= var s = a t = b while s != U[s]: s = U[s] while t != U[t]: t = U[t] return s == t proc union(U : var unionfindtree; a : int ; b : int)= if U.find(a,b): return var s = a t = b t2 : int while s != U[s]: s = U[s] while t != U[t]: t2 = U[t] U[t] = s t = t2 U[t] = s proc root(U : unionfindtree, a :int):int= var s = a while s != U[s]: s = U[s] return s proc distance(a,b,c,d : int): float64 = var A = a.float64 - c.float64 B = b.float64 - d.float64 return sqrt(A * A + B * B) var N = stdin.readline.parseInt D : array[1000,array[1000,float64]] P : array[1000,array[2,int]] UT : unionfindtree[1000] x,y : int for i in 0..<1000: UT[i] = i for n in 0.. 0: echo memo.dis + 2 else: echo 1