CSES - KILO 2018 2/5 - Simplified Sudoku
  • Time limit: 1.00 s
  • Memory limit: 512 MB

You are given a grid of size n×nn \times n whose each element is an integer between 11 and nn.

Your task is to find out if every row and column contains nn distinct values.

Input

The first line contains an integer nn: the size of the grid.

After this, there are nn lines which describe the grid. Each line has nn integers between 11 and nn.

Output

Print YES if every row and column contsina nn distinct values and NO otherwise.

Constraints

  • 1n1001 \le n \le 100

Example 1

Input:

3
1 2 3
2 3 1
3 1 2

Output:

YES

Example 2

Input:

3
1 1 1
1 1 1
1 1 1

Output:

NO