13227 - Yu-Gi-Oh!   

Description

Seto Kaiba is a grand master player of Yu-Gi-Oh.

Cards are necessary, and it's why Kaiba buys cards from time to time.

The cards are labeled with numbers.

The card Kaiba has the most is his ace. If there are two or more kinds of cards Kaiba has the most at the same time, the cards with maximum number is Kaiba's ace.

For example,

Buy: 2; Cards in hand: 2; Ace: 2

Buy: 1; Cards in hand: 2 1; Ace: 2 (Becasue 2 is the largest number)

Buy: 1; Cards in hand: 2 1 1; Ace: 1 (Becasue 1 is the most one)

Please find out what Kaiba's ace is whenever he buys a new card.

Input

The first line contains a number N — Kaiba buys N cards in total.

Each of the next N lines contains a number ai — the number of the cards Kaiba buys.

testcase 1 and 2: N <= 100, ai <= 109.

testcase 3 and 4: N <= 3000, ai <= 1018.

testcase 5 and 6: N <= 100000, ai <= 1018.

Output

The output should contains N lines, each of which contains a number — Kaiba's ace.

Remember to add new line at last.

Sample Input  Download

Sample Output  Download

Tags




Discuss