#T127. 看病

看病

Description

A friend working at a hospital has asked BSNY to help develop a registration system. The situation is as follows: recently, more and more people are coming to the hospital for medical treatment, leading to long queues. Patients are admitted in batches only when there is availability.

However, hospital queues differ from other types of queues because, in most cases, patients with more severe conditions should be prioritized. Therefore, BSNY is asked to design the system such that the severity of the condition serves as the priority to determine who gets to see a doctor next.

Input Format

The first line contains an integer n, indicating the number of operations.

For each operation:

  • If the operation is push, it will be followed by two inputs: ai (the patient's name) and bi (the severity level of the patient's condition).
  • If the operation is pop, there will be no additional input, but you are required to output the result.

Output Format

For each pop operation, output the name and priority level of the patient with the highest severity currently in the queue, indicating that they can now see the doctor.

If no one is in the queue at that time, output "none" (see the sample for details).

7
pop
push bob 3
push tom 5
push ella 1
pop
push zkw 4
pop

none
tom 5
zkw 4


Hint

【Data Scale and Constraints】 1 ≤ n ≤ 100,000. Each person has a unique priority level, where 0 ≤ priority ≤ 2,000,000,000. Names consist of lowercase letters only and have a length of less than 20 characters.