#include <algorithm>
#include <cctype>
#include <cmath>
#include <cstring>
#include <iostream>
#include <sstream>
#include <numeric>
#include <map>
#include <set>
#include <queue>
#include <vector>

using namespace std;

vector<vector<int>> solve(int N, const vector<vector<int>>& A) {
	int c = *min_element(A[0].begin(), A[0].end());
	vector<int> a(N), b(N);
	for (int j = 0; j < N; ++j) {
		b[j] = A[0][j] - c;
	}
	for (int i = 1; i < N; i++) {
		c = *min_element(A[i].begin(), A[i].end());
		for (int j = 0; j < N; ++j) {
			if (A[i][j] - c != b[j]) {
				return {};
			}
		}
	}
	c = 1 << 30;
	for (int i = 0; i < N; i++) {
		c = min(c, A[i][0]);
	}
	for (int i = 0; i < N; i++) {
		a[i] = A[i][0] - c;
	}
	for (int j = 1; j < N; ++j) {
		c = 1 << 30;
		for (int i = 0; i < N; i++) {
			c = min(c, A[i][j]);
		}
		for (int i = 0; i < N; i++) {
			if (A[i][j] - c != a[i]) {
				return {};
			}
		}
	}
	int d = A[0][0] - a[0] - b[0];
	for (int j = 0; j < N; ++j) {
		b[j] += d;
	}
	return { a, b };
}

int main() {
	int N;
	cin >> N;
	vector<vector<int>> A(N, vector<int>(N));
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < N; ++j) {
			cin >> A[i][j];
		}
	}
	vector<vector<int>> ans = solve(N, A);
	if (ans.empty()) {
		cout << "No" << endl;
	} else {
		cout << "Yes" << endl;
		for (auto a : ans) {
			string delim = "";
			for (auto x : a) {
				cout << delim << x;
				delim = " ";
			}
			cout << endl;
		}
	}
	return 0;
}

#include<bits/stdc++.h>
using namespace std;
//#define int long long
#define REP(i,m,n) for(int i=(m);i<(n);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define all(a) a.begin(),a.end()
#define rall(c) (c).rbegin(),(c).rend()
#define mp make_pair
#define endl '\n'
#define vec vector<ll>
#define mat vector<vector<ll> >
#define fi first
#define se second
#define double long double
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> pll;
//typedef long double ld;
typedef complex<double> Complex;
const ll INF=1e9+7;
const ll MOD=998244353;
const ll inf=INF*INF;
const ll mod=MOD;
const ll MAX=20000010;




signed main(){
    ll n;cin>>n;
    vector<vector<ll> >c(n,vector<ll>(n));
    rep(i,n){
        rep(j,n)cin>>c[i][j];
    }
    bool f=1;
    vector<vector<ll> >d(n,vector<ll>(n));
    ll mi=0;
    REP(i,1,n){
        bool g=1;
        rep(j,n){
            d[i][j]=c[i][j]-c[0][j];
            if(j>0&&d[i][j]!=d[i][j-1])g=0;
            mi=min(mi,d[i][j]);
        }
        f&=g;
    }
    if(!f){
        cout<<"No"<<endl;
        return 0;
    }
    mi=-mi;
    vector<ll>a(n);
    vector<ll>b(n);
    a[0]=mi;
    REP(i,1,n){
        a[i]=mi+d[i][0];
    }
    rep(i,n){
        b[i]=c[0][i]-mi;
        if(b[i]<0)f=0;
    }
    if(f){
        cout<<"Yes"<<endl;
        rep(i,n){
            cout<<a[i]<<' ';
        }
        cout<<endl;
        rep(i,n){
            cout<<b[i]<<' ';
        }
        cout<<endl;
    }else{
        cout<<"No"<<endl;
    }
}