import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.PrintWriter;

public class puzzle_dg {

	public static void main(String[] args) {
		new Thread(){
			public void run() {
				try {
					new puzzle_dg().run();
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
		}.start();
	}
	
	final int maxN = 200;

	protected void run() throws IOException {
		BufferedReader in = new BufferedReader(new FileReader("puzzle.in"));
		PrintWriter out = new PrintWriter("puzzle.out");
		
		int n = Integer.parseInt(in.readLine());
		assert n >= 1 && n <= maxN : "Wrong n";
		
		char[][] c = new char[n][];
		for (int i = 0; i < n; i++) {
			c[i] = in.readLine().toCharArray();
			assert c[i].length == n : "Line " + (i + 1) + " has wrong length";
			for (int j = 0; j < n; j++) {
				assert c[i][j] == '0' || c[i][j] == '1' : "Line " + (i + 1) + " has symbol " + (char) (c[i][j]);
			}
			for (int p = 1; p < n; p++) {
				boolean eq = true;
				for (int j = 0; j < n; j++) {
					if (c[i][j] != c[i][(j + p) % n]) {
						eq = false;
						break;
					}
				}
				assert !eq : "Line " + (i + 1) + " has shift " + p;
			}
		}
		
		assert in.readLine() == null : "Extra information";
		int[] d = new int[n];
		for (int row = 1; row < n; row++) {
			int which = 0;
			for (int col = 0; col < row; col++) {
				boolean eq = true;
				for (int i = 0; i < row; i++) {
					if (c[i][(col + d[i]) % n] != c[i][(row + d[i]) % n]) {
						eq = false;
						break;
					}
				}
				if (eq) {
					which = col;
					break;
				}
			}
			for (d[row] = 0; d[row] < n; d[row]++) {
				if (c[row][(d[row] + row) % n] != c[row][(d[row] + which) % n]) {
					break;
				}
			}
		}
		
		out.println("Yes");
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < n; j++) {
				out.print(c[i][(j + d[i]) % n]);
			}
			out.println();
		}
		
		in.close();
		out.close();
	}

}
