Given a permutation of chart positions, list the download-chart positions of entries that a later single outranks, in ascending order.
Easy3ArraySortingInterviewNo attempts yetTime limit5sMemory limit256 MBThe music business changes fast, and the single charts change with it. At first the Dutch Single Top 100 ranked singles purely by CD single sales. Those numbers later dropped sharply while legal and illegal downloads from the internet grew, so from 2006 on, downloads of singles from specific legal download sites counted towards the chart as well. Today even streams from some platforms count towards the Single Top 100.
From 2006 to 2013, while the Single Top 100 reflected both CD singles and downloads, a separate Download Top 100 ranked singles by downloads alone. Assume that both charts used the same weekly download numbers. Comparing the two charts then tells you which singles sold well physically. Some singles were not released as CD singles at all, so the comparison also tells you which singles were certainly available as a CD single: the ones that rank better, compared to some other single, in the Single Top 100 than in the Download Top 100.
Write a program that finds those singles. Other countries run single charts of other sizes, so your program must not be limited to charts that contain exactly one hundred singles.
Stated precisely, let Pi be the position in the Download Top N of the single ranked i in the Single Top N. That single is certainly available as a CD single if there is at least one index j with j>i and Pj<Pi.
The first line contains an integer T, the number of test cases (1 ≤ T ≤ 20). Each test case is given as follows.
As the description above implies, the Download Top N and the Single Top N contain exactly the same N singles, possibly in a different order.
The sum of N over all test cases is at most 300,000.
For each test case, print the following.