Easy Quest

Given a sequence of gifts (+type), costs (-type), and unicorns (0), decide if every cost can be paid and choose the lexicographically smallest item type for each unicorn.

Medium5GreedyImplementationArrayHash mapInterviewNo attempts yetTime limit3sMemory limit512 MB

Problem

A young hero is starting his heroic life. A wise wizard gave him an easy first quest. During the quest the hero meets nn magical creatures in a fixed order. To help him, the wizard handed him a list of nn integers a1,a2,,ana_1, a_2, \dots, a_n.

  • If aia_i is positive, the ii-th creature is benevolent and gives the hero one magical item of type aia_i. The hero may keep several items of the same type.
  • If aia_i is negative, the ii-th creature is evil, and defeating it costs one magical item of type ai-a_i. Every magical item is fragile and can be used only once.
  • If aia_i is zero, the ii-th creature is a unicorn. It gives the hero a magical item of any type he asks for, but only one item.

Decide whether the hero can defeat every enemy on the way and finish the quest. If he can, decide what to ask each unicorn for.

Input

The first line contains one integer nn (1n10001 \le n \le 1000).

The second line contains nn integers a1,a2,,ana_1, a_2, \dots, a_n separated by single spaces (1000ai1000-1000 \le a_i \le 1000).

Output

If the hero cannot defeat every enemy, print No.

Otherwise print Yes on the first line. On the second line print the type the hero asks each unicorn for, in the order he meets the unicorns, separated by single spaces. Every type must be an integer between 1 and 1000. If the hero meets no unicorn, print only Yes.

When several sequences of requests work, print the lexicographically smallest one. For two sequences xx and yy of the same length, xx is lexicographically smaller than yy when there is a position jj with xj<yjx_j < y_j and xi=yix_i = y_i for every i<ji < j.