{$R+,Q+}
program puzzle;

uses
	sysutils;

const
	maxn = 200;

var
	i, j, k, l, p, n: longint;
	ch: char;
	found, match: boolean;
	a: array [1..maxn, 1..2 * maxn] of longint;

begin
	reset(input, 'puzzle.in');
	rewrite(output, 'puzzle.out');

	readln(n);
	for i := 1 to n do begin
		for j := 1 to n do begin
			read(ch);
			a[i][j] := ord(ch) - ord('0');
		end;
		readln;
		for j := 1 to n do begin
			a[i][n + j] := a[i][j];
		end;

		found := false;
		for j := 1 to n - 1 do begin
			match := true;
			for k := 1 to n do begin
				if a[i][k] <> a[i][k + j] then begin
					match := false;
					break;
				end;
			end;
			if match then begin
				found := true;
				break;
			end;
		end;
		assert(not found, 'Line ' + inttostr(i) + ' equals its circular shift');
	end;


	for i := 1 to n do begin
		l := 0;
		for j := 1 to i - 1 do begin
			match := true;
			for k := 1 to i - 1 do begin
				if a[k][j] <> a[k][i] then begin
					match := false;
					break;
				end;
			end;
			if match then begin
				l := j;
				break;
			end;
		end;
		if l <> 0 then begin
			p := 0;
			for j := 0 to n - 1 do begin
				if a[i][l + j] <> a[i][i + j] then begin
					p := j;
					break;
				end;
			end;

			for j := 1 to n do begin
				a[i][j] := a[i][j + p];
			end;
		end;
	end;

	writeln('Yes');
	for i := 1 to n do begin
		for j := 1 to n do begin
			write(a[i][j]);
		end;
		writeln;
	end;

	close(input);
	close(output);
end.
