In an ICPC contest, there are multiple problems, and the contest lasts for a long duration. There are $$$n$$$ accepted submissions in total, each representing a successful attempt by a team on a problem. When a team makes an accepted submission for a problem, we say that the team has solved that problem. Note that if a team submits multiple accepted solutions for the same problem, only the first such submission is considered as solving the problem for the first time.
You need to determine for each submission whether a balloon should be awarded according to the following rules:
The first line of input contains $$$n$$$ ($$$1 \leq n \leq 5\,000$$$), denoting the number of accepted submissions.
The next $$$n$$$ lines describe the submissions in chronological order. Each submission contains three integers $$$a$$$ ($$$1 \leq a \leq 410$$$), $$$b$$$ ($$$1 \leq b \leq 13$$$), and $$$c$$$ ($$$0 \leq c \lt 300$$$), representing the team ID, the problem ID, and the submission time in minutes, respectively. It is guaranteed that the submission times are non-decreasing.
For each submission, output the problem ID if a balloon corresponding to that problem should be awarded, or otherwise output $$$0$$$.
81 1 101 2 201 3 301 4 2501 5 2601 6 2701 7 2802 1 290
1 2 3 0 0 0 0 1
| Название |
|---|


