#クエリ回数上限+1確認 def floor_log(n): a,p=0,1 while p*2<=n:a,p=a+1,p*2 return a O,R=print,range I=lambda:int(input()) N=I() q=int(floor_log(N**(N-1))-(N-1)/2+1)+1 n=R(N) Q=[0]*N u=set(i+1for i in n) v=set(u) def S(Q,k): v=set(u) for i in n: Q[i],k=sorted(v)[k//F[N-i-1]],k%F[N-i-1] v.remove(Q[i]) if N<9: F=[1] for i in n:F+=[F[-1]*(i+1)] l,r=0,F[N] while l