#include <bits/stdc++.h>

#define MN 1001000

using namespace std;
typedef long long ll;

#define MOD 998244353

ll n, w[110], dp[102][10010][102], fat[110], sum;

ll solve(int i, int sum, int rem) {
    if(rem < 0 || sum < 0) return 0;
    if(i == n) return (sum == 0 && rem == 0);
    ll &x = dp[i][sum][rem];
    if(x != -1) return x;
    x = solve(i + 1, sum - w[i], rem - 1) + solve(i + 1, sum, rem);
    if(x >= MOD) x -= MOD;
    return x;
}

int main() {
    fat[0] = 1;
    for(ll i = 1; i <= 101; i++)
        fat[i] = fat[i-1] * i % MOD;

    scanf("%lld", &n);
    for(int i = 0; i < n; i++) {
        scanf("%lld", &w[i]);
        sum += w[i];
    }

    if(sum % 2) puts("0");
    else {
        ll ans = 0;
        memset(dp, -1, sizeof dp);
        for(int i = 1; i < n; i++) {
            ans += solve(0, sum / 2, i) * fat[i] % MOD * fat[n-i] % MOD;
            if(ans >= MOD) ans -= MOD;
        }
        printf("%lld\n", ans);
    }

    return 0;
}

#include<bits/stdc++.h>
#define ll long long 
#define mp make_pair 
#define f(i,n) for(int i=0;i<n;i++) 
#define F first 
#define S second 
#define pb push_back 

using namespace std;

void test(){
	ll n;
	cin>>n;
	ll c[n][n];
	f(i,n)f(j,n)cin>>c[i][j];
	if(n==1){
		cout<<"Yes\n";
		cout<<c[0][0]<<"\n";
		cout<<"0\n";
		return ;
	}
	
	ll p[n][n-1];
	f(i,n){
		for(int j=1;j<n;j++){
			p[i][j-1] = c[i][j] - c[i][j-1];
		}
	}
	
	ll q[n-1][n];
	f(i,n){
		for(int j=1;j<n;j++){
			q[j-1][i] = c[j][i] - c[j-1][i];
		}
	}
	
	f(col,n-1){
		for(int row=1;row<n;row++){
			if(p[row][col]!=p[row-1][col]){
				cout<<"No\n";
				return ;
			}
		}
	}
	f(row,n-1){
		for(int col=1;col<n;col++){
			if(q[row][col]!=q[row][col-1]){
				cout<<"No\n";
				return ;
			}
		}
	}
	
	ll a[n], b[n];
	// a[0] = 0, b[0] = c[0][0];
	ll n1 = 0, n2 = 0;
	ll m1 = 0, m2 = 0;
	for(int i=1;i<n;i++){
		n1 = n1 + p[0][i-1];
		m1 = min(m1,n1);
		n2 = n2 + q[i-1][0];
		m2 = min(m2,n2);
	}
	
	ll val1 = max(0LL,-1LL*m1) + max(0LL,-1LL*m2);
	if(c[0][0]<(val1)){
		cout<<"No\n";
		return ;
	}
	cout<<"Yes\n";
	a[0] = max(0LL,-1LL*m1);
	b[0] = c[0][0] - a[0];
	
	for(int i=1;i<n;i++){
		a[i] = a[i-1] + p[0][i-1];
		b[i] = b[i-1] + q[i-1][0];
	}
	
	f(i,n)cout<<b[i]<<" ";cout<<"\n";
	f(i,n)cout<<a[i]<<" ";cout<<"\n";
	
	
}

int main(){
	std::ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int tests=1;
	// cin>>tests;
	while(tests--){
		test();
	}
}
