#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
//#include<boost/multiprecision/cpp_int.hpp>
//#include<boost/multiprecision/cpp_dec_float.hpp>
//namespace mp=boost::multiprecision;
//#define mulint mp::cpp_int
//#define mulfloat mp::cpp_dec_float_100
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
constexpr int MOD=1000000007;
//constexpr int MOD=998244353;
#define INF (1<<30)
#define LINF (lint)(1LL<<56)
#define endl "\n"
#define rep(i,n) for(lint (i)=0;(i)<(n);(i)++)
#define reprev(i,n) for(lint (i)=(n-1);(i)>=0;(i)--)
#define Flag(x) (1<<(x))
#define Flagcount(x) __builtin_popcountll(x)
#define pint pair<int,int>
#define pdouble pair<double,double>
#define plint pair<lint,lint>
#define fi first
#define se second
typedef long long lint;
int dx[8]={1,1,0,-1,-1,-1,0,1};
int dy[8]={0,1,1,1,0,-1,-1,-1};
const int MAX_N=2e5+5;
//struct edge{lint to,num;};
//vector<int> bucket[MAX_N/1000];


int main(void){
    int N;
    cin >> N;
    lint A[N],B[N];
    rep(i,N) cin >> A[i];
    rep(i,N) cin >> B[i];
    lint ans=accumulate(A,A+N,0LL);
    int n=N/2;
    lint odd[n],even[N];
    for(int i=0;i<N;i+=2) even[i/2]=B[i]-A[i];
    for(int i=1;i<N;i+=2) odd[i/2]=B[i]-A[i];
    sort(odd,odd+n,greater<lint>());
    sort(even,even+n,greater<lint>());
    rep(i,n){
        if(odd[i]+even[i]>0) ans+=odd[i]+even[i];
    }
    cout << ans << endl;
}
#include<iostream>
#include<vector>
using namespace std;
typedef long long li;
#define minimize(a,b) (a>(b)?a=(b),1:0)
#define rep(i,n) for(int i=0;i<(n);i++)
#define df 0
template<class T> void print(const T& t){ cout << t << "\n"; }
template<class T, class... Ts> void print(const T& t, const Ts&... ts) { cout << t; if (sizeof...(ts)) cout << " "; print(ts...); }

// Container コンテナ型, map以外
template< template<class ...> class Ctn,class T>
std::ostream& operator<<(std::ostream& os,const Ctn<T>& v){
  auto itr=v.begin();
  while(itr!=v.end()){
    if(itr!=v.begin())cout << " ";
    cout << *(itr++);
  }
  return os;
};

void makea(vector<vector<li>>& c,vector<li>& a){
  int n=c.size();
  rep(i,n-1){
    a[i]=c[i+1][0]-c[0][0];
  }
}
void makeb(vector<vector<li>>& c,vector<li>& b){
  int n=c.size();
  rep(j,n-1){
    b[j]=c[0][j+1]-c[0][0];
  }
}
int judgea(vector<vector<li>>& c,vector<li>& a){
  int n=c.size();
  rep(i,n-1){
    rep(j,n){
      if(a[i]!=c[i+1][j]-c[0][j]) return 0;
    }
  }
  return 1;
}
int judgeb(vector<vector<li>>& c,vector<li>& b){
  int n=c.size();
  rep(j,n-1){
    rep(i,n){
      if(b[j]!=c[i][j+1]-c[i][0]) return 0;
    }
  }
  return 1;
}
pair<li,int> mini(vector<li>& a){
  int n=a.size();
  int it=0;
  li m=0;
  rep(i,n){
    if(minimize(m,a[i])) it=i+1;
  }
  return {m,it};
}

int main(){
  int n; cin >>n;
  vector<vector<li>> c(n,vector<li>(n));
  rep(i,n) rep(j,n) cin >>c[i][j];
  if(n==1){
    print("Yes");
    print(0);
    print(c[0]);
    return 0;
  }
  vector<li> a(n-1,0),b(n-1,0);
  makea(c,a);
  if(df)print(a);
  makeb(c,b);
  if(df)print(b);
  if(!judgea(c,a)){
    print("No");
    return 0;
  }
  if(!judgeb(c,b)){
    print("No");
    return 0;
  }
  if(df)print(1);
  pair<li,int> ma=mini(a),mb=mini(b);
  li aa=c[ma.second][mb.second]-ma.first;
  li bb=-mb.first;
  vector<li> ansa(n,aa),ansb(n,bb);
  rep(i,n-1){
    ansa[i+1]=aa+a[i];
    ansb[i+1]=bb+b[i];
  }
  print("Yes");
  print(ansa);
  print(ansb);
}
