describe
The bank has customers, and each customer has a priority, from 1 to 5, with level 1 being the highest and level 5 being the lowest. If you work in a bank, high-priority customers can walk in front of you at any time. Now, you are given a sequence of events describing which customers arrived when, and when the customers were serviced. Whenever there is a client to serve, you have to tell us which client it is. If several customers have the same priority, it will be served on a first-come, first-served basis.
Input format:
The first line is a positive integer n, telling you how many events there are. (1 ≤ n ≤ 500)
The next n lines describe the event:
if it starts with "a", it means that a customer has arrived. It will then be followed by two numbers: the customer number and the priority.
If it is "p", it means that it is the turn of the customer with the highest priority.
Output format:
For each "p" event, output the customer number served.
Example:
enter:
4
a 1 3
a 2 2
a 3 2
p
Output:
2
code
#include <iostream>
#include