Олимпиадный тренинг

Задача 33129. loops


Given the adjacency matrix of an undirected graph, determine if it contains loops.
 
Input: 
- the first line contains the number n (\(1<=n<=100\)) – number of graph vertices;
- then the  adjacency matrix is ​​set - n rows of n numbers, each of which is equal to 0 or 1 .
 
Output: output  "YES" if the graph contains loops, and "NO" otherwise.
 

 

Examples
# Input Output
1
5
1 1 1 1 0 
1 0 1 1 1 
1 1 0 1 1 
1 1 1 1 1 
0 1 1 1 0 
YES