This is an interactive problem.
A permutation a\[1],a\[2],…,a\[n] of integers from 1 to n is hidden from you.
Your task is to sort it in ascending order by comparing and swapping pairs of elements. This problem could be pretty easy, but the jury member responsible for the problem was too concentrated on floating-point arithmetic in problems G and J and implemented an "imprecise" comparator:
Your program can make queries to compare any two elements with this comparator, or to swap any two elements. After each swap, it will be told whether the permutation became sorted.
Sort a permutation of size up to 16,384 using no more than 300,000 queries.