#include <iostream>
using namespace std;

int arr[105][105];

int main() {
    int n;
    while (scanf("%d", &n) != EOF) { // 注意 while 处理多个 case
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < n; j++) {
                scanf("%d", &arr[i][j]);
            }
        }
        int i, j;
        for (i = 0; i < n; i++) {
            for (j = 0; j < n; j++) {
                if(i == j){ //对角线的元素不用检查
                    continue;
                }else{
                    int t1 = arr[i][j];
                    int t2 = arr[j][i];
                    if(t1 != t2){
                        break;
                    }
                }
            }
            if(j < n){
                break;
            }
        }
        if(j < n){
            printf("No!\n");
        }else{
            printf("Yes!\n");
        }
    }
}
// 64 位输出请用 printf("%lld")