- Time limit: 1.00 s
- Memory limit: 512 MB
You are given a grid of size whose each element is an integer between and .
Your task is to find out if every row and column contains distinct values.
Input
The first line contains an integer : the size of the grid.
After this, there are lines which describe the grid. Each line has integers between and .
Output
Print YES if every row and column contsina distinct values and NO otherwise.
Constraints
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