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]0 A=E m=n.fastLog2+1 d=newSeq[int]n p=newSeqWith m:newSeq[int]n for _ in 0..d[v]:swap u,v;for k in 0..