Stock Prices

No attempts yetTime limit2sMemory limit128 MB

Problem

Buy low, sell high — that is how you make a profit in the stock market (short selling is ignored here). Of course, no one can predict a stock's future price, so it is hard to know exactly when to buy or sell, or how much profit repeated trading could earn.

Still, if you are given the price history of a stock over the last $n$ days, the maximum profit that could have been made is certainly computable. Here we are interested instead in the days on which the $k_1$ lowest prices and the $k_2$ highest prices occurred.

Input

The input consists of several test cases.

The first line of each case contains three integers $n$, $k_1$, and $k_2$ ($1 \le n \le 10^6$, $k_1 + k_2 \le n$, $1 \le k_1, k_2 \le 100$).

The next line contains $n$ non-negative integers; the $i$-th of them ($1 \le i \le n$) is the stock price on day $i$.

The input ends with a line containing $n = k_1 = k_2 = 0$, which must not be processed.

Output

For each test case, print three lines.

  • The first line contains the case number in the form Case x, where $x$ starts from 1.
  • The second line lists the days on which the $k_1$ lowest prices occur, sorted in ascending order.
  • The third line lists the days on which the $k_2$ highest prices occur, sorted in descending order.

Separate the values on a line with a single space. When several days share the same price and more than one list is valid, print the lexicographically smallest list for the lowest prices and the lexicographically largest list for the highest prices.