#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <complex>
#include <vector>
#include <limits>
#include <iomanip>
#include <cassert>
#include <numeric>
#include <chrono>
#include <random>

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define debug(x) cerr << #x << " = " << (x) << endl;
#define debug_pii(x) cerr << "(" << x.first << "," << x.second << ")";
#define rep(i, n) for(int i = 0;i < n;i++)
#define pb push_back
#define F first
#define S second

// template<typename _Ty1, typename _Ty2>
// ostream& operator<<(ostream& _os, const pair<_Ty1, _Ty2>& _p) {
//     _os << '(' <<_p.first << ',' << _p.second << ')';
//     return _os;
// }
//
// template<typename _Ty1, typename _Ty2>
// istream& operator>>(istream& _is, pair<_Ty1, _Ty2>& _p) {
//     _is >> _p.first >> _p.second;
//     return _is;
// }

void solve() {
  int n;cin>>n;
  vector<ll> a(2*n);ll sum=0, temp = 0;
  rep(i,2*n){
    cin>>a[i];sum+=a[i];
  }
  int i = n-1, j = n;
  multiset<ll> ms;ms.insert(a[i]);ms.insert(a[j]);
  while(i >= 0) {
    temp += *ms.begin();
    ms.erase(ms.begin());
    i--;j++;
    if(i >= 0) {
      ms.insert(a[i]);ms.insert(a[j]);
    }
  }
  cout<<sum-temp<<endl;
}

// 6 -> 1 2 3  6

// <

// greedy will fail
// 8 4 7 4 -> 8, 4 -> 12
// 8 4 7 4 -> 7, 8 -> 15
//
// 1 2 3 4 5 6 7 8
// + * * + * * + +
//
// 1 2 3 4 5 6 7 8
// * * * * + + +  +
//
// 1 2 3 4 5 6 7 8
// + + * * * * + +
//
// 1 4 5 8 7 6 3 2
//
// 7 5 3 1=16 (36)

int main() {

 // freopen("input.in","r",stdin);
 // freopen("output.out","w",stdout);
 // cout << fixed << setprecision(15);

 ios_base::sync_with_stdio(false);
 cin.tie(nullptr);

 int t = 1;
 // cin >> t;
 while (t--) {
   solve();
 }

 return 0;
}

#include <bits/stdc++.h>
#ifndef ONLINE_JUDGE
#define _GLIBCXX_DEBUG
#endif
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = s; i < (int)(n); i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define vec vector
#define rip return 0
typedef long long ll;
typedef pair<ll,ll> P;
ll max(ll x,ll y){
if(x>y)return x;
else return y;
}
ll min(ll x,ll y){
if(x<y)return x;
else return y;
}

int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout<<fixed<<setprecision(12);
  /*-------------------------------------------*/
  int n;
  cin>>n;
  vec<vec<ll>> c(n,vec<ll>(n));
  rep(i,n){
    rep(j,n){
      cin>>c[i][j];
    }
  }
  vec<ll> down(n-1),across(n-1);
  rep(i,n-1){
    down[i]=c[i+1][0]-c[0][0];
    across[i]=c[0][i+1]-c[0][0];
    rep(j,n-1){
      if(c[i+1][j]-c[0][j]!=down[i] || c[j][i+1]-c[j][0]!=across[i]){
        cout<<"No"<<endl;rip;
      }
    }
  }
  
  vec<ll> a(n),b(n);
  ll ma=1e10,md=1e10;
  rep(i,n-1){
    md=min(md,down[i]);
    ma=min(ma,across[i]);
  }
  if(md<0)a[0]=md*-1;
  if(ma<0&&(c[0][0]-a[0])<(ma*-1)){
    cout<<"No"<<endl;rip;
  }
  b[0]=c[0][0]-a[0];
  
  rep(i,n-1)a[i+1]=a[0]+down[i];
  rep(i,n-1)b[i+1]=b[0]+across[i];
                    
  if(a[n-1]+b[n-1]!=c[n-1][n-1]){
    cout<<"No"<<endl;rip;
  }

  cout<<"Yes"<<endl;
  rep(i,n)cout<<a[i]<<" ";
  cout<<endl;
  rep(i,n)cout<<b[i]<<" ";
  cout<<endl;
}