#include <iostream>
#include <vector>

using namespace std;

template <class T>
T gcm(T a, T b) {
    if (a < b) {
        T w = a;
        a = b;
        b = w;
    }

    while (b != 0) {
        T w = a % b;
        a = b;
        b = w;
    }

    return a;
}

int main() {
    vector<long long> p = { 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47 };

    int n;
    cin >> n;

    vector<long long> x(n);
    for (int i = 0; i < n; i++) {
        cin >> x[i];
    }

    long long res = 1;
    for (int i = 0; i < static_cast<int>(p.size()); i++) {
        res *= p[i];
    }

    for (int i = 1; i < (1 << p.size()); i++) {
        long long q = 1;
        for (int j = 0; j < static_cast<int>(p.size()); j++) {
            if ((i & (1 << j)) > 0) {
                q *= p[j];
            }
        }

        bool r = true;
        for (int j = 0; j < n; j++) {
            r = r && gcm(q, x[j]) > 1;
        }

        if (r && res > q) {
            res = q;
        }
    }

    cout << res << endl;
}

#include <cstdio>
#include <vector>
#include <cstring>
#include <algorithm>
using namespace std;

const int N=505;

int n;
int a[N][N];

int diff[N];
int ans_a[N],ans_b[N];

int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
		for(int j=1;j<=n;j++)
			scanf("%d",&a[i][j]);
	
	bool flag=true;
	for(int i=1;i<n;i++)
		diff[i]=a[1][i+1]-a[1][i];
	
	for(int i=2;i<=n;i++)
		for(int j=1;j<n;j++)
			if(diff[j]!=a[i][j+1]-a[i][j])
				flag=false;
	
	int mn=1<<30;
	for(int i=1;i<=n;i++)
		mn=min(mn,a[1][i]);
	for(int i=1;i<=n;i++)
		ans_b[i]=a[1][i]-mn;
	for(int i=1;i<=n;i++)
	{
		ans_a[i]=(a[i][1]-a[1][1])+(a[1][1]-ans_b[1]);
		if(ans_a[i]<0)
			flag=false;
	}
	
	if(flag)
	{
		printf("Yes\n");
		for(int i=1;i<=n;i++)
			printf("%d%c",ans_a[i],i==n?'\n':' ');
		for(int i=1;i<=n;i++)
			printf("%d%c",ans_b[i],i==n?'\n':' ');
	}
	else
		printf("No\n");
	return 0;
}