import java.io.FileReader;
import java.io.InputStreamReader;
import java.io.IOException;
import java.io.BufferedReader;
import java.util.Scanner;
class Main
{
public static final boolean DEBUG = false;
public static boolean check(int[][] a) {
int len = a.length;
for (int i = 0; i < len; i++) {
for (int j = i; j < len; j++) {
if (a[i][j] != a[j][i]) return false;
}
}
return true;
}
public static void main(String[] args) throws IOException
{
Scanner cin;
int n;
if (DEBUG) {
cin = new Scanner(new FileReader("d:\\OJ\\uva_in.txt"));
} else {
cin = new Scanner(new InputStreamReader(System.in));
}
while (cin.hasNext()) {
n = cin.nextInt();
int[][] a = new int[n][n];
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
a[i][j] = cin.nextInt();
}
}
System.out.println(check(a) ? "Yes!" : "No!");
}
}
}