#include<iostream>
#include<vector>
#include<string>
#include<sstream>
#include<functional>
#include<algorithm>
#include<map>
#include<queue>
#include<stack>
using namespace std;
int main() {
	int n;
	cin >> n;
	vector<vector<long long>> a(n, vector<long long>(n)),coma(n,vector<long long>(n)), comb(n, vector<long long>(n));
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) cin >> a[i][j];
	}
	for (int i = 1; i < n; i++) {
		for (int j = 1; j < n; j++) {
			coma[i][j] = a[i][j] - a[i][j - 1] - (a[i - 1][j] - a[i - 1][j - 1]);
		}
	}
	for (int i = 1; i < n; i++) {
		for (int j = 1; j < n; j++) {
			comb[i][j] = a[i][j] - a[i - 1][j] - (a[i][j - 1] - a[i - 1][j - 1]);
		}
	}
	bool ans = true;
	for (int i = 1; i < n; i++) {
		for (int j = 1; j < n; j++) {
			if (comb[i][j] != 0 || coma[i][j] != 0) ans = false;
		}
	}
	if (!ans) cout << "No" << endl;
	else {
		vector<int> ansa(n), ansb(n), an(n), bn(n);;
		for (int i = 0; i < n; i++) ansa[i] = a[0][i];
		for (int i = 0; i < n; i++) ansb[i] = a[i][0];
		for (int i = 0; i < n; i++) an[i] = ansa[i];
		for (int i = 0; i < n; i++) bn[i] = ansb[i];
		sort(an.begin(), an.end());
		sort(bn.begin(), bn.end());
		int af = ansa[0] - an[0], bf = ansb[0] - bn[0];
		if (af + bf > ansa[0]) cout << "No" << endl;
		else {
			cout << "Yes" << endl;
			for (int i = 0; i < n; i++) {
				ansb[i] -= af;
				cout << ansb[i];
				if (i < n - 1) cout << " ";
				else cout << endl;
			}
            int k = ansa[0];
			for (int i = 0; i < n; i++) {
				ansa[i] -= k - af;
				cout << ansa[i];
				if (i < n - 1) cout << " ";
				else cout << endl;
			}
		}
	}
}
// template
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

struct Input
{
	int id;
    int x;
    int y;
    int r;
	int sx,sy,gx,gy;
};

bool compare_pos(Input a, Input b)
{
	if (a.x == b.x)
	{
		return a.y < b.y;
	}
	else
	{
		return a.x < b.x;
	}
}

bool compare_id(Input a, Input b)
{
	return a.id < b.id;
}

int main(void)
{
	int N;
	cin >> N;
    vector<Input> input(N);
	for (size_t i = 0; i < N; i++)
	{
		input[i].id = i;
		cin >> input[i].x >> input[i].y >> input[i].r;
	}

	// input[0]が一番左上
	sort(input.begin(), input.end(), compare_pos);

	int idx = 0;
	int left = 0;
	int top = 0;

	for (int i = 0; i < N; i++)
	{
		if (i < N-1 && input[i + 1].x == input[i].x)
		{
			input[i].sx = left;
			input[i].sy = top;
			input[i].gx = input[i].x + 1;
			input[i].gy = input[i].y + 1;

			top = input[i].y + 1;
		}
		else
		{
			input[i].sx = left;
			input[i].sy = top;
			input[i].gx = input[i].x + 1;
			input[i].gy = 10000;

			left = input[i].x + 1;
			top = 0;
		}
	}

	sort(input.begin(), input.end(), compare_id);
	for (int i = 0; i < N; i++)
	{
		printf("%d %d %d %d\n", input[i].sx,
								input[i].sy,
								input[i].gx,
								input[i].gy);
	}
	
}