12036 - Stable Grid


Difficulty : easy

Solution Description :
Simple Grid problem

Suppose Input

n=3
1 1 2
2 2 1
3 3 3

Here 1 = 3 time, 2= 3 time, 3= 3 time
if any number count more than n time then print no
otherwise print yes

For this example ans is "yes"

Another Example
n=3
1 1 2
2 2 3
3 3 2

Here 1 = 2 time, 2= 4 time, 3= 3 time
Here number 2 is 4 time so. it is more then n 
For this example ans is "no"