using System;
using System.Collections.Generic;
using System.Linq;
class Program
{
static string InputPattern = "InputX";
static List<string> GetInputList()
{
var WillReturn = new List<string>();
if (InputPattern == "Input1") {
WillReturn.Add("3");
WillReturn.Add("4 3 5");
WillReturn.Add("2 1 3");
WillReturn.Add("3 2 4");
//Yes
//2 0 1
//2 1 3
}
else if (InputPattern == "Input2") {
WillReturn.Add("3");
WillReturn.Add("4 3 5");
WillReturn.Add("2 2 3");
WillReturn.Add("3 2 4");
//No
}
else {
string wkStr;
while ((wkStr = Console.ReadLine()) != null) WillReturn.Add(wkStr);
}
return WillReturn;
}
static void Main()
{
List<string> InputList = GetInputList();
int[,] BanArr = CreateBanArr(InputList.Skip(1));
int UB = BanArr.GetUpperBound(0);
int MinVal = BanArr.Cast<int>().Min();
int TargetX = -1;
int TargetY = -1;
bool WillBreak = false;
for (int LoopX = 0; LoopX <= UB; LoopX++) {
for (int LoopY = 0; LoopY <= UB; LoopY++) {
if (BanArr[LoopX, LoopY] == MinVal) {
TargetX = LoopX;
TargetY = LoopY;
WillBreak = true;
break;
}
}
if (WillBreak) break;
}
var XValDict = new SortedDictionary<int, int>();
var YValDict = new SortedDictionary<int, int>();
XValDict[TargetX] = 0;
for (int LoopY = 0; LoopY <= UB; LoopY++) {
YValDict[LoopY] = BanArr[TargetX, LoopY];
}
for (int LoopX = 0; LoopX <= UB; LoopX++) {
XValDict[LoopX] = BanArr[LoopX, 0] - YValDict[0];
}
// 十分性のチェック
bool IsOK = true;
for (int LoopX = 0; LoopX <= UB; LoopX++) {
for (int LoopY = 0; LoopY <= UB; LoopY++) {
if (BanArr[LoopX, LoopY] != XValDict[LoopX] + YValDict[LoopY]) {
IsOK = false;
}
}
}
if (IsOK) {
Console.WriteLine("Yes");
// セパレータとInt型の列挙を引数として、結合したstringを返す
Func<string, IEnumerable<int>, string> IntEnumJoin = (pSeparater, pEnum) =>
{
string[] StrArr = Array.ConvertAll(pEnum.ToArray(), pX => pX.ToString());
return string.Join(pSeparater, StrArr);
};
Console.WriteLine(IntEnumJoin(" ", YValDict.Values));
Console.WriteLine(IntEnumJoin(" ", XValDict.Values));
}
else {
Console.WriteLine("No");
}
}
////////////////////////////////////////////////////////////////
// IEnumerable<string>をintの2次元配列に設定する
////////////////////////////////////////////////////////////////
static int[,] CreateBanArr(IEnumerable<string> pStrEnum)
{
var StrList = pStrEnum.ToList();
if (StrList.Count == 0) {
return new int[0, 0];
}
int[] IntArr = { };
Action<string> SplitAct = pStr =>
IntArr = pStr.Split(' ').Select(pX => int.Parse(pX)).ToArray();
SplitAct(StrList[0]);
int UB_X = IntArr.GetUpperBound(0);
int UB_Y = StrList.Count - 1;
int[,] WillReturn = new int[UB_X + 1, UB_Y + 1];
for (int Y = 0; Y <= UB_Y; Y++) {
SplitAct(StrList[Y]);
for (int X = 0; X <= UB_X; X++) {
WillReturn[X, Y] = IntArr[X];
}
}
return WillReturn;
}
}