Triangle Speeches

In a class with $N$ students, it is time for the obligatory task of giving a speech. Most students are very excited to give their speeches and can hardly wait for their turn. First, they must be divided into three groups. Everyone in group $1$ will then present to group $2$, group $2$ to group $3$, and group $3$ to group $1$.

One complication in this grouping is that the students have different ambition levels. Each student $i$ requires to give their speech to at least $A_ i$ people. So, if student $i$ ends up in group $1$, group $2$ must have at least $A_ i$ members for student $i$ to be satisfied.

\includegraphics[width=6cm]{triangeltal.png}
Figure 1: The image corresponds to the first example.

Your task is to determine, given the students’ ambition levels, if there is a way to divide the students into three groups so that everyone is satisfied, and if so, find a valid division.

Input

The first line contains an integer $N$ ($3 \leq N \leq 5 \cdot 10^5$), the number of students in the class.

The second line contains $N$ integers $A_ i$ ($1 \leq A_ i \leq N$), where $A_ i$ is the minimum number of students the $i$-th student wants to give a speech to.

Output

If there is no valid division, print a single line with the string “NO”.

If there is a valid division, first print a line with the string “YES”. Then, print a line with a string $S$ consisting of the characters 1, 2, and 3. The character at position $i$ in this string indicates which group student $i$ belongs to. If there are multiple solutions, you can print any of them.

Scoring

Your solution will be tested on a set of test groups, each worth a number of points. Each test group contains a set of test cases. To get the points for a test group you need to solve all test cases in the test group.

Group

Points

Constraints

$1$

$14$

$A_1 = A_2 = \cdots = A_ N$

$2$

$16$

$N \leq 10$

$3$

$11$

$A_ i \leq 3$

$4$

$23$

$N \leq 3000$

$5$

$36$

No additional constraints.

Sample Input 1 Sample Output 1
10
1 3 1 3 3 2 4 1 5 2
YES
3313332121
Sample Input 2 Sample Output 2
3
1 2 2
NO