#D11575. Graph

    ID: 9624 Type: Default 1000ms 134MiB

Graph

Graph

There are two standard ways to represent a graph G=(V,E)G = (V, E), where VV is a set of vertices and EE is a set of edges; Adjacency list representation and Adjacency matrix representation.

An adjacency-list representation consists of an array Adj[V]Adj[|V|] of V|V| lists, one for each vertex in VV. For each uVu \in V, the adjacency list Adj[u]Adj[u] contains all vertices vv such that there is an edge (u,v)E(u, v) \in E. That is, Adj[u]Adj[u] consists of all vertices adjacent to uu in GG.

An adjacency-matrix representation consists of V×V|V| \times |V| matrix A=aijA = a_{ij} such that aij=1a_{ij} = 1 if (i,j)E(i, j) \in E, aij=0a_{ij} = 0 otherwise.

Write a program which reads a directed graph GG represented by the adjacency list, and prints its adjacency-matrix representation. GG consists of n  (=V)n\; (=|V|) vertices identified by their IDs 1,2,..,n1, 2,.., n respectively.

Constraints

  • 1n1001 \leq n \leq 100

Input

In the first line, an integer nn is given. In the next nn lines, an adjacency list Adj[u]Adj[u] for vertex uu are given in the following format:

uu kk v1v_1 v2v_2 ... vkv_k

uu is vertex ID and kk denotes its degree. viv_i are IDs of vertices adjacent to uu.

Output

As shown in the following sample output, print the adjacent-matrix representation of GG. Put a single space character between aija_{ij}.

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 nn is given. In the next nn lines, an adjacency list Adj[u]Adj[u] for vertex uu are given in the following format:

uu kk v1v_1 v2v_2 ... vkv_k

uu is vertex ID and kk denotes its degree. viv_i are IDs of vertices adjacent to uu.

outputFormat

Output

As shown in the following sample output, print the adjacent-matrix representation of GG. Put a single space character between aija_{ij}.

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>