#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); ++i)

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);

    int n;
    cin >> n;

    vector<int> a(n), b(n), d(n);
    rep(i, n) cin >> a[i];
    rep(i, n) cin >> b[i];
    rep(i, n) d[i] = b[i] - a[i]; // d>0なら[],B選択が有利

    vector<int> even(n / 2), odd(n / 2);
    rep(i, n / 2) even[i] = d[i * 2];
    rep(i, n / 2) odd[i] = d[i * 2 + 1];

    sort(even.begin(), even.end(), greater<int>());
    sort(odd.begin(), odd.end(), greater<int>());

    int64_t ans = 0;
    rep(i, n / 2)
    {
        int t = even[i] + odd[i];
        if (t > 0)
            ans += t;
    }
    rep(i, n) ans += a[i];
    cout << ans << '\n';

    return 0;
}

#include<bits/stdc++.h>
using namespace std;
#define rep(i,n)    for(int i=0;i<(int)n;i++)
using ll = long long;
using P = pair<int,int>;
bool chtr(vector<vector<ll>> a){
    ll n=a.at(0).size();
    rep(i,n-1){
        rep(j,n-1){
            if((a.at(i+1).at(j+1)-a.at(i).at(j+1))!=(a.at(i+1).at(j)-a.at(i).at(j))){
                return true;
            }
        }
    }
    return false;
}
ll minh(vector<ll> a){
    sort(a.begin(),a.end());
    return a.at(0);
}
int main(){
    ll n;   cin>>n;
    vector<vector<ll>> a(n,vector<ll>(n));
    vector<ll> b(n),c(n); 
    b.at(0)=0;
    rep(i,n){
        rep(j,n){
            cin>>a.at(i).at(j);
        }
    }
    if(chtr(a)){
        cout<<"No"<<endl;
    }else{
        cout<<"Yes"<<endl;
        rep(i,n-1){
            b.at(i+1)=a.at(i+1).at(0)-a.at(0).at(0);
        }
        ll adjust=abs(minh(b));
        rep(i,n){
            b.at(i)+=adjust;
            c.at(i)=a.at(0).at(i)-b.at(0);
        }
        rep(i,n){
            cout<<b.at(i)<<" ";
        }
        cout<<endl;
        rep(i,n){
            cout<<c.at(i)<<" ";
        }
        cout<<endl;
    }
}