Heaps

5

2 votes
Very-Easy
Problem

You are given a list of amount of money of T people, one by one. After each element in the list print the top 3 richest people's amount of money.

Input:
First line contains an integer, T, number of queries.
Next T lines contains an integer each, X.
ith query contains amount of money ith person have.

Output:
For each query, print the top 3 richest people's amount of money in the town and if there are less than 3 people in town then print -1.

Constraints:
1T105
1X106

Time Limit: 1
Memory Limit: 256
Source Limit:
Editor Image

?