uHunt#2544

uHunt

1 second
64 megabytes
Medium

For those who do not know, uHunt stands for "UVa Hunting" and is a tool for UVa online-judge that tracks which problems you have solved, provides statistics, and suggests choices for the next problem to tackle.

This website was created by my brother Felix Halim. Considering that UVa online-judge so far has about 9 million submissions (approximately one submission every few seconds), about 3000 different programming problems, and about 120000 different users (probably only thousands are currently active), my brother has to highly optimize this tool so all features work "instantly".

In this problem, we will focus on a small subset of uHunt's features, specifically, the "instant re-ranking of accepted submissions". One of the parameters ranked on UVa online judge is the accepted submission's runtime on judge's data and machine.

Suppose we are focusing on problem_id "100". Previously, there were 4 accepted submissions for this problem with the following ranking, in this format: (rank, user_name, runtime_speed_in_seconds):

1. josh 0.120 2. nhahtdh 0.127 3. felix 0.223 4. steven 0.323

Now, if the user "you" submits an accepted code for problem_id "100", and this code is judged to have a runtime of 0.127s, then "you" will be placed as the new rank 3, and "felix" and "steven" will be demoted to ranks 4 and 5, respectively. Note that even though "you" has the same runtime as "nhahtdh", "you" will be ranked after "nhahtdh", who submitted the accepted code earlier.

1. josh 0.120 2. nhahtdh 0.127 3. you 0.127 4. felix 0.223 5. steven 0.323

Suppose user "you" is not satisfied with being ranked 3 and chooses to improve the accepted code for problem_id "100". Upon resubmission, if the new code (with more optimizations) is judged to have a runtime of 0.115s, then "you" will now be placed as rank 1, and "josh" and "nhahtdh" will be demoted to ranks 2 and 3, respectively. Notice that "felix" and "steven" remain at ranks 4 and 5.

1. you 0.115 2. josh 0.120 3. nhahtdh 0.127 4. felix 0.223 5. steven 0.323

If another user "grace" submits an accepted code for problem_id "100" with a runtime of 3.475s, then the ranking becomes:

1. you 0.115 2. josh 0.120 3. nhahtdh 0.127 4. felix 0.223 5. steven 0.323 6. grace 3.475

If user "you" later submits another accepted code for problem_id "100" with a runtime of 0.121s, which is actually slower than this user's previous best, UVa online judge (and uHunt) "ignores" this submission. The ranking remains:

1. you 0.115 2. josh 0.120 3. nhahtdh 0.127 4. felix 0.223 5. steven 0.323 6. grace 3.475

Input

The first line of input is (1 \leq n \leq 50000), the number of submissions, sorted by submission time. You must process these submissions one by one.

Each of the next lines contains three numbers: problem_id, user_id, and .

problem_id is a three-digit integer in the range [100-199] representing the problem number.

user_id is a four-digit integer in the range [0000-9999] representing the coder's identification id.

is a real number with at most digits after the decimal point.

You can be sure that t \leq 9.999 (since the time limit for all problems is less than seconds). The value is the runtime for the accepted code of user user_id for problem problem_id.

Output

For each line of input, immediately output five numbers separated by a single space:

problem_id, user_id, and — these three values are the same as in the input, followed by:

best_t_for_this_problem_id, and finally:

rank_of_user_id_for_this_problem_id

best_t_for_this_problem_id is defined as the runtime of the accepted code submitted by the top coder (currently ranked 1) for this particular problem.

rank_of_user_id_for_this_problem_id is defined as the ranking of the current coder for this particular problem, as described above.

However, if a user's submission is slower than or equal to their previous best, output: "submission ignored" (without quotes), in a single line instead.

Examples

Example 1

Loading
Loading