#include <bits/stdc++.h>

#define endl '\n'
#define fi first
#define se second
#define MOD(n,k) ( ( ((n) % (k)) + (k) ) % (k))
#define forn(i,n) for (int i = 0; i < int(n); i++)
#define forr(i,a,b) for (int i = a; i <= b; i++)
#define all(v) v.begin(), v.end()
#define pb push_back

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ii> vii;

const int MX = 505;
int n, a[MX][MX];

int main() {
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	
	cin >> n;
	forn (i, n)
		forn (j, n) {
			cin >> a[i][j];
			
			if (i && j)
				if (a[i][j] - a[i][j - 1] != a[i - 1][j] - a[i - 1][j - 1]) {
					cout << "No" << endl;
					return 0;
				}
		}
	
	int ind = 0;
	forn (i, n)
		if (a[i][0] < a[ind][0])
			ind = i;
	
	cout << "Yes" << endl;
	
	forn (i, n)
		cout << a[i][0] - a[ind][0] << " ";
	cout << endl;
	
	forn (i, n)
		cout << a[ind][i] << " ";
	cout << endl;	
 
	return 0;
}

#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <numeric>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <regex>
#include <complex>
using namespace std;
#define all(v) v.begin(),v.end()
#define GS std::greater<int>()
#define FOR(i,l,r) for(Int i=(l);i<(r);i++)
#define DCOUT cout<<fixed<<setprecision(15) //DCOUT<<d<<endl;
#define ROUNDUP(a,b) ((a)+((b)-1))/(b)
#define TDVEC(name,type,h,w) vector<vector<type>>name((h),vector<type>(w))
#define P pair<Int,Int>
#define MOD 1000000007
#define MOD2 998244353
#define INF (1<<29)
#define LINF (1LL<<60)
#define PI 3.1415926535897932384626433832795028
#define itn int
#define space ' '
typedef long long Int;
typedef unsigned long long uInt;
typedef long double ld;
Int gcd(Int a,Int b){return b?gcd(b,a%b):a;}
Int lcm(Int a,Int b){return a/gcd(a,b)*b;}

int main(){
	Int r1,c1,r2,c2;cin>>r1>>c1>>r2>>c2;
	if(r1==r2&&c1==c2){cout<<0<<endl;return 0;}
	if(abs(r1-r2)+abs(c1-c2)<=3||(r1+c1==r2+c2)||(r1-c1==r2-c2)){cout<<1<<endl;return 0;}
	if((r1+c1)%2==(r2+c2)%2||abs(abs(r1-r2)-abs(c1-c2))<=3||abs(r1-r2)+abs(c1-c2)<=6){cout<<2<<endl;return 0;}
	cout<<3<<endl;
	return 0;
}