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

Sample Input
5
1
2
3
4
5
Sample Output
-1
-1
3 2 1
4 3 2
5 4 3
Time Limit: 1
Memory Limit: 256
Source Limit:
Editor Image

?