401677: GYM100513 B Colored Blankets

Memory Limit:512 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

B. Colored Blanketstime limit per test1 secondmemory limit per test512 megabytesinputstandard inputoutputstandard output

Recently Polycarp has opened a blankets store and he faced with many challenges.

He has got k blankets. A blanket has two sides, each of k blankets has at most one colored side. So either both sides are uncolored or one side is colored and the other one is not. If a side is colored, one of n possible colors is used. It is known that k is divisible by n.

Polycarp wants to color all uncolored sides in such a way that:

  • each blanket will have both sides colored (one color per side), the colors can be the same or different, all the used colors are from n possible colors;
  • it will be possible to compose n kits with blankets in each kit that blankets in each kit are identically colored.

It is allowed to turn over blankets to determine that they are identically colored: for example, red-blue and blue-red blankets are identically colored. Blankets in different kits can be identically colored.

Input

The first line contains two integer numbers k and n (1 ≤ n ≤ k ≤ 1000) — number of blankets and colors. It is guaranteed that k is divisible by n. The second line contains a sequence of integers c1, c2, ..., ck (1 ≤ ci ≤ n or ci =  - 1), where ci stands for the color of the colored side of the i-th blanket or  - 1 if it is uncolored.

Output

If there is no solution for the problem, print "No" in the first line. Otherwise print a line containing "Yes" and k lines describing each blanket. The i-th line should contain a pair of colors (integers in the range 1, 2, ..., n) used for the i-th blanket. You may print colors in pairs in any order.

If there are multiple solutions, print any of them.

ExamplesInput
6 2
1 1 2 2 -1 2
Output
Yes
1 2
2 1
2 2
2 2
2 1
2 2
Input
8 4
4 -1 1 -1 4 3 -1 -1
Output
Yes
4 1
2 1
2 1
3 1
1 4
3 1
4 1
4 1

加入题单

算法标签: