favorite We need a little bit of your help to keep things running, click on this banner to learn more

Graph representation

From adjacency matrix to the list of edges - 2

The simple oriented graph is given by the adjacency matrix. Print its representation as a list of edges.


The first line contains number of vertices n (1n100) in the graph. Each of the next n lines contains n elements – the description of adjacency matrix.


Print the list of edges, ordered by the first vertex in a pair that describes an edge.

Time limit 1 second
Memory limit 128 MiB
Input example #1
0 1 0
0 0 1
1 1 0
Output example #1
1 2
2 3
3 1
3 2