from sys import stdin

n = int(stdin.readline())

v = [[0] * n for _ in range(n)]

for u in range(n):

    l = [int(j) for j in stdin.readline().split()]

    for k in l[2:]:

        v[u][k - 1] = 1

    print((*v[u]))
n = int(eval(input()))

MAP = [[0] * n for _ in range(n)]

for i in range(n):

    u, k, *v = list(map(int, input().split()))

    for j in v:

        MAP[u - 1][j - 1] = 1

for m in MAP:

    print((*m))



from sys import stdin

n = int(stdin.readline())
v = [[0] * n for _ in range(n)]
for u in range(n):
    l = [int(j) for j in stdin.readline().split()]
    for k in l[2:]:
        v[u][k - 1] = 1
    print((*v[u]))

n = int(eval(input()))
MAP = [[0] * n for _ in range(n)]
for i in range(n):
    u, k, *v = list(map(int, input().split()))
    for j in v:
        MAP[u - 1][j - 1] = 1
for m in MAP:
    print((*m))

-from sys import stdin - -n = int(stdin.readline()) -v = [[0] * n for _ in range(n)] -for u in range(n): -    l = [int(j) for j in stdin.readline().split()] -    for k in l[2:]: -        v[u][k - 1] = 1 -    print((*v[u])) +n = int(eval(input())) +MAP = [[0] * n for _ in range(n)] +for i in range(n): +    u, k, *v = list(map(int, input().split())) +    for j in v: +        MAP[u - 1][j - 1] = 1 +for m in MAP: +    print((*m))