import java.io.*; public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(br.readLine()); String[][] array = new String[n][n]; for (int i = 0; i < n; i++) { String[] arr = br.readLine().split(" "); for (int j = 0; j < n; j++) { array[i][j] = arr[j]; } } System.out.println(judge(array, n)); } public static String judge(String[][] arr, int row) { for (int i = 0; i < row; i++) { for (int j = 0; j < i; j++) { if (Integer.parseInt(arr[i][j]) != 0) { return "NO"; } } } return "YES"; } }