import sequtils,bitops,strutils proc r:any=stdin.readLine.parseInt proc R:any=stdin.readLine.split.map parseInt var n=r() E=newSeqWith n:newSeq[int]() A=E o:tuple[d:seq[int],p:seq[seq[int]],n,m:int] for _ in 0..o.d[v]:swap u,v for k in 0..