lss4.war - The Great War


Version: v6

Submit Problemset 2000ms / 262144 KB
Difficulty:1.0x

Statement

This is supposed to be Problem D

Doragon is an aqua dragon girl. She is fighting against the DAG(Dragon Attack Group), a group of people who thinks dragons should not not exist. Doragon is taking part in one of the wars.

In this war, the battlefield can been seen as a N*N grid. On each grid, there is a limit of soldiers $A_{i,j}$. On each row, there is also a limit of numbers of soldiers in this row $R_{i}$.

It is known that DAG will attack in column. According to report, a total number of $C_j$ DAG soldiers will attack on column J.

If in any column, the sum of dragon soldiers are strictly less than the number of DAG soldiers, dragons will fail and the battle is considered as a loss.

If in any column, the sum of dragon soldiers are strictly more than the number of DAG soldiers, dragons will fight with each other and the battle is also considered as a loss.

Doragon, the commander of this battle, wants to plan the soldier in a way that dragons will win. Could you tell her if it is possible.

Input

The first line contains N.

The next line contains integer array R

The next line contains integer array C

Then a N*N grid of integers, the matrix A

Output

Output "NO" if there are no ways to win.

Otherwise print "YES" then follow by N*N grids, your planning. If there are many, print any.

Examples

Input

4
18 25 20 3
3 26 7 23
5 10 3 6
1 9 4 9
0 9 9 9
2 0 0 2

Output

YES
1 9 2 6
1 9 4 9
0 8 1 7
1 0 0 1

Constraints

Please look at the table: | Test ID | N= | Property 1? | |---------|----|-------------| | 1 | 1 | N | | 2 | 1 | N | | 3 | 2 | N | | 4 | 2 | N | | 5 | 5 | N | | 6 | 10 | N | | 7 | 10 | Y | | 8 | 20 | N | | 9 | 20 | Y | | 10 | 50 | N |

Property 1: Answer is NO. Print it if you don't know how to solve.

$0\leq A_{i,j}\leq 10^6$

$0\leq R_i,C_j\leq 10^9$


Submit