#include <bits/stdc++.h>

using namespace std;
using ll = long long;

int main() {
  int n;
  cin >> n;
  int C[n][n];
  vector<ll> A;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++) cin >> C[i][j];

  for (int i = 0; i < n; i++) A.push_back(C[0][i]);
  vector<ll> B;
  B.push_back(0);

  ll Bmin = 1000000001;
  bool state = true;
  for (int i = 1; i < n; i++) {
    int j = 0;
    ll sa = C[i][j] - C[i - 1][j];
    while (j < n) {
      if (C[i][j] != C[i - 1][j] + sa) {
        state = false;
        break;
      }
      C[i][j] = C[i - 1][j];
      j++;
    }
    if (state == false) break;
    B.push_back(sa);
    Bmin = min(Bmin, sa);
  }

  if (state) {
    cout << "Yes" << endl;
    if (Bmin < 0) {
      ll absmin = (ll)abs(Bmin);

      for (int i = 0; i < n; i++) {
        if (i) cout << ' ';
        cout << B[i] + absmin;
      }

      cout << endl;
      for (int i = 0; i < n; i++) {
        if (i) cout << ' ';
        cout << A[i] - absmin;
      }

      cout << endl;
    } else {
      for (int i = 0; i < n; i++) {
        if (i) cout << ' ';
        cout << B[i];
      }

      cout << endl;
      for (int i = 0; i < n; i++) {
        if (i) cout << ' ';
        cout << A[i];
      }

      cout << endl;
    }
  } else {
    cout << "No" << endl;
  }
}
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=(n)-1;i>=0;i--)
#define perl(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define pb push_back
#define ins insert
#define pqueue(x) priority_queue<x,vector<x>,greater<x>>
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
#define rev(x) reverse(x);
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
using vpl=vector<pl>;
using vvpl=vector<vpl>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[8]={1,0,-1,0,1,1,-1,-1};
const ll dx[8]={0,1,0,-1,1,-1,1,-1};
template <typename T> inline bool chmax(T &a, T b) {
  return ((a < b) ? (a = b, true) : (false));
}
template <typename T> inline bool chmin(T &a, T b) {
  return ((a > b) ? (a = b, true) : (false));
}

int main(){
  ll n;cin >> n;
  string s;cin >> s;
  vl a(n+1);rep(i,n+1)cin >> a[i];
  ll k=inf;rep(i,n)chmin(k,abs(a[i+1]-a[i]));
  cout << k <<endl;
  vvl mat(k,vl(n+1));
  vl use(n+1);
  rep(i,k){
    rep(j,n+1){
      mat[i][j]=a[j]/k;
      use[j]+=a[j]/k;
    }
  }
  rep(i,n+1)a[i]-=use[i];
  rep(i,n+1){
    rep(j,a[i]){
      mat[j][i]++;
    }
  }
  rep(i,k){
    rep(j,n+1)cout << mat[i][j] <<" ";cout << endl;
  }
} 