#D11575. Graph
Graph
Graph
There are two standard ways to represent a graph , where is a set of vertices and is a set of edges; Adjacency list representation and Adjacency matrix representation.
An adjacency-list representation consists of an array of lists, one for each vertex in . For each , the adjacency list contains all vertices such that there is an edge . That is, consists of all vertices adjacent to in .
An adjacency-matrix representation consists of matrix such that if , otherwise.
Write a program which reads a directed graph represented by the adjacency list, and prints its adjacency-matrix representation. consists of vertices identified by their IDs respectively.
Constraints
Input
In the first line, an integer is given. In the next lines, an adjacency list for vertex are given in the following format:
...
is vertex ID and denotes its degree. are IDs of vertices adjacent to .
Output
As shown in the following sample output, print the adjacent-matrix representation of . Put a single space character between .
Example
Input
4 1 2 2 4 2 1 4 3 0 4 1 3
Output
0 1 0 1 0 0 0 1 0 0 0 0 0 0 1 0
inputFormat
Input
In the first line, an integer is given. In the next lines, an adjacency list for vertex are given in the following format:
...
is vertex ID and denotes its degree. are IDs of vertices adjacent to .
outputFormat
Output
As shown in the following sample output, print the adjacent-matrix representation of . Put a single space character between .
Example
Input
4 1 2 2 4 2 1 4 3 0 4 1 3
Output
0 1 0 1 0 0 0 1 0 0 0 0 0 0 1 0
样例
4
1 2 2 4
2 1 4
3 0
4 1 3
0 1 0 1
0 0 0 1
0 0 0 0
0 0 1 0
</p>