#include <iostream> using namespace std; int main() { int a[10][10], c; cin >> c; for (int i = 0; i < c; i++) { for (int j = 0; j < c; j++) { cin >> a[i][j]; } } for (int i = 0; i < c; i++) { for (int j = i - 1; j >= 0; j--) { if (i == c - 1 && j == 0 && a[i][j] == 0) cout << "YES"; else if (a[i][j] != 0) { cout << "NO"; return 0; } } } }