Perfect Game

Find the level order that minimizes the expected time to clear every level in one deathless run when any death restarts the run from the first level.

Medium7GreedyProbabilitySortingNo attempts yetTime limit5sMemory limit512 MB

Problem

You are playing a video game that gives you an achievement if you clear every level consecutively without dying. You may play the levels in any order you like, and each attempt at a level either clears it or kills you. Every level has a fixed chance of killing you and a fixed duration for one attempt. Dying in a level takes exactly as long as clearing it. As soon as you die, you start again from the first level of your chosen order.

Find the order of levels that minimizes the expected time to earn the achievement.

Note: failing a level kills only your character in the game, not you. Otherwise almost nobody would go after this achievement.

Input

The first line contains the number of test cases TT. Then TT test cases follow, each of which consists of three lines.

The first line of each test case contains the number of levels NN. The second line contains NN space-separated integers LiL_i. LiL_i is the number of seconds one attempt at level ii lasts, and it is the same whether you clear the level or die in it. The third line contains NN space-separated integers PiP_i. PiP_i is the percent chance that you die in any single attempt at level ii.

Limits

  • 1T1001 \le T \le 100
  • 1N201 \le N \le 20
  • 1Li1001 \le L_i \le 100
  • 0Pi<1000 \le P_i < 100

Output

For each test case, print one line starting with Case #x: , where xx is the case number starting from 1. After it print NN space-separated integers. The jjth integer is the index of the jjth level you attempt, and the order must minimize the expected time to earn the achievement. Level indices run from 00 to N1N-1.

If several orders give the same expected time, print the lexicographically least one. Between two orders, the one with the smaller index at the first position where they differ comes first lexicographically. Among many orders, the lexicographically least one is the order that is lexicographically smaller than every other order.