403858: GYM101341 M Last Man Standing

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

M. Last Man Standingtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard output

A company of n friends decided to play a multiplayer shooter in the Last Man Standing mode. The distinctive feature of this mode is when a player is killed, he does not respawn, but waits a round to finish. A round finishes when there is only one player alive.

You are given a notarized screenshot of the current fight results, made during the first round of the game. It provides an information about how many kills each player has made. You want to check if it's a fake or not, i.e. whether such situation could occur during the game.

Input

The first line contains a single integer n (1 ≤ n ≤ 200000) — the number of players.

The second line contains n integers ai separated by a space (0 ≤ ai ≤ 109) — the numbers of kills made by each player. These numbers are given in non-increasing order.

Output

If such situation was not possible in the game, output «NO» (without quotes).

Otherwise, in the first line output «YES» (without quotes), and then output a log of kills in the round, consisting of k pairs of integers, where k is the total number of kills made at the moment of taking the screenshot. Each pair of integers in the log must consist of the number of the player who made the kill, and the number of the killed player, exactly in this order. Records in the log must be ordered chronologically. If there are several correct logs, output any of them.

ExamplesInput
5
2 1 1 0 0
Output
YES
3 5
2 4
1 3
1 2
Input
7
3 2 2 0 0 0 0
Output
NO
Input
1
0
Output
YES
Input
3
1 0 0
Output
YES
1 3

加入题单

上一题 下一题 算法标签: