From adjacency matrix to adjacency list#472

From adjacency matrix to adjacency list

1 second
128 megabytes
Very easy (≈850)

A simple directed graph is given with an adjacency matrix. Print its representation in the form of adjacency list.

Input

First line contains the number of vertices in a graph n~(1 \le n \le 100). Then the adjacency matrix is given. It is guaranteed that graph does not contain loops.

Output

Print lines — the adjacency list of the graph. Print in the -th line the number of edges adjacent to the -th vertex, and then the vertex numbers where these edges go in increasing order.

Examples

Example 1

Loading
Loading