Under construction

Still being built. Things may change

Eurokod

Interview

Time limit1sMemory limit1024 MB

Summary
Given the president's ranking and each code's member vote count, print the codes by summed points in descending order, breaking ties by member votes.
Level

Easy2 of 10

Topics
Sorting, Implementation
Solved
No attempts yet

Statement

This year, for the first time, the Eurokod is being held, an international competition in writing beautiful and readable code.

There are nn contestants, labeled from 11 to nn. Each of them has written one code.

An association of computer scientists evaluates the codes. The association consists of a president and members. The president and the members award points in different ways.

President's points: The president ranks the codes from the most beautiful to the least beautiful. The first code receives nn points, and each following code receives one point less than the previous one.

Members' points: Each member votes for the code he considers the most beautiful. After all votes are cast, the codes are ranked in descending order of votes. The first code receives nn points, and each following code receives one point less than the previous one.

Total points: The total for each code is the sum of the points from the president and the points from the members.

Print the codes in descending order of total points. If codes have the same total, the code that received more points from the members is ranked higher.

Input

The first line contains an integer nn (1≤n≤501 \le n \le 50), the number of contestants.

The second line contains nn integers aia_i (1≤ai≤n1 \le a_i \le n). The ii-th integer is the label of the code that the president ranked ii-th, from the most beautiful to the least beautiful. Every label from 11 to nn appears exactly once.

The third line contains nn integers bib_i (0≤bi≤2000 \le b_i \le 200). The ii-th integer is the number of votes that code ii received from the members. No two codes receive the same number of votes.

Output

Print nn lines with the ranking in descending order of total points. Each line has the form [rank]. Kod[label] ([number of points]). The label is written with two digits and a leading zero when needed. For example, if code 3 is first with 12 points, the first line is 1. Kod03 (12).

Hints

In the first example, Kod03 and Kod02 both have 3 points, but Kod03 received more votes from the members, so it is ranked higher.

In the second example, the president ranked Kod05 first, so it received n=5n = 5 points.

Examples3

  1. Example 1

    Input
    3
    1 2 3
    50 10 20
    
    Expected output
    1. Kod01 (6)
    2. Kod03 (3)
    3. Kod02 (3)
    
  2. Example 2

    Input
    5
    5 2 4 1 3
    4 5 2 1 3
    
    Expected output
    1. Kod02 (9)
    2. Kod05 (8)
    3. Kod01 (6)
    4. Kod04 (4)
    5. Kod03 (3)
    
  3. Example 3

    Input
    7
    6 3 2 1 5 4 7
    200 56 11 0 13 105 12
    
    Expected output
    1. Kod06 (13)
    2. Kod01 (11)
    3. Kod02 (10)
    4. Kod03 (8)
    5. Kod05 (7)
    6. Kod07 (4)
    7. Kod04 (3)