Background
Serious businessman Vladimir Bludgeon, who was once well known as Scorched Vlad, controls a trust of N enterprises. A former accomplice of Vladimir, famous banker Alexander Ironfist, whose alias was Wry Alex, owns a holding company of N banks. As it should be among the old friends, the enterprises of Mr. Bludgeon take credits at the banks of Mr. Ironfist only, and the banks of Mr. Ironfist give credits to the enterprises of Mr. Bludgeon only. All data about the amounts of the credits is properly hidden to evade taxes.
But one day an old rival of Vladimir and Alexander, police general Ivan Crowbar alias Rotten Ivan has come on the scene. Mr. Crowbar wants to take his revenge on Mr. Bludgeon and Mr. Ironfist for old insults and reveal all credit operations between their enterprises and banks.
Problem
For a start Ivan's people seized some documents from the offices of Vladimir's enterprises. For each enterprise the total amount of credits SR[i], which were taken by this enterprise, was found. Then during the similar operations for each Alexander's bank the total amount of credits SC[i], which were given by this bank, was found. The final step is to use these findings and fill so-called credit matrix. Here the credit matrix is a square table with N rows and N columns, and each element A[i, j] of this matrix should be equal to amount of the credit which was taken by i-th enterprise of Mr. Bludgeon at j-th bank of Mr. Ironfist. It is known for certain that an amount of any credit is an integer number between 0 and 100. It should be remembered that the data obtained during Ivan's operations could be falsified, so it may be impossible to fill the credit matrix.
Input
The first line contains the integer N (2 ≤ N ≤ 100). The second line contains N integers SR[i] (0 ≤ SR[i] ≤ 32000). The third line contains N integers SC[j] (0 ≤ SC[j] ≤ 32000). The sum of all SR[i] is equal to the sum of all SC[j].
Output
You should output "NO", if the credit matrix cannot be filled. Otherwise the first line should contain "YES", and each of the next N lines should contain N corresponding elements A[i, j] of the credit matrix. The elements should be separated by single spaces. If the problem has several solutions, you may output any of them.
Sample
input | output |
---|
4
267 157 188 259
193 320 346 12
| YES
100 55 100 12
0 70 87 0
0 95 93 0
93 100 66 0
|
Problem Author: Ilya Grebnov, Nikita Rybak, Dmitry Kovalioff
Problem Source: Timus Top Coders: First Challenge