#!/usr/bin/env python

# -*- coding: utf-8 -*-





import sys





def generate_graph(v_info):

    for info in v_info:

        adj_info = info[2:]

        for each in adj_info:

            adj_matrix[int(info[0]) - 1][int(each) - 1] = 1

    return adj_matrix





if __name__ == '__main__':

    _input = sys.stdin.readlines()

    vertex_num = int(_input[0])

    vertex_info = list([x.split() for x in _input[1:]])

    adj_matrix = [[0] * vertex_num for _ in range(vertex_num)]

    # assert len(vertex_info) == vertex_num



    ans = generate_graph(vertex_info)

    for v_result in ans:

        print((*v_result))
#!/usr/bin/env python

# -*- coding: utf-8 -*-





import sys





def generate_graph(v_info):

    for info in v_info:

        adj_info = info[2:]

        assert len(adj_info) == int(info[1])

        for each in adj_info:

            adj_matrix[int(info[0]) - 1][int(each) - 1] = 1

    return adj_matrix





if __name__ == '__main__':

    _input = sys.stdin.readlines()

    vertex_num = int(_input[0])

    vertex_info = list([x.split() for x in _input[1:]])

    adj_matrix = [[0] * vertex_num for _ in range(vertex_num)]

    # assert len(vertex_info) == vertex_num



    ans = generate_graph(vertex_info)

    for v_result in ans:

        print((*v_result))
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys


def generate_graph(v_info):
    for info in v_info:
        adj_info = info[2:]
        for each in adj_info:
            adj_matrix[int(info[0]) - 1][int(each) - 1] = 1
    return adj_matrix


if __name__ == "__main__":
    _input = sys.stdin.readlines()
    vertex_num = int(_input[0])
    vertex_info = list([x.split() for x in _input[1:]])
    adj_matrix = [[0] * vertex_num for _ in range(vertex_num)]
    # assert len(vertex_info) == vertex_num
    ans = generate_graph(vertex_info)
    for v_result in ans:
        print((*v_result))

#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys


def generate_graph(v_info):
    for info in v_info:
        adj_info = info[2:]
        assert len(adj_info) == int(info[1])
        for each in adj_info:
            adj_matrix[int(info[0]) - 1][int(each) - 1] = 1
    return adj_matrix


if __name__ == "__main__":
    _input = sys.stdin.readlines()
    vertex_num = int(_input[0])
    vertex_info = list([x.split() for x in _input[1:]])
    adj_matrix = [[0] * vertex_num for _ in range(vertex_num)]
    # assert len(vertex_info) == vertex_num
    ans = generate_graph(vertex_info)
    for v_result in ans:
        print((*v_result))

+        assert len(adj_info) == int(info[1])