import std.stdio;
import std.string;
import std.conv;
import std.algorithm;

void main() {
    int n = readln.chomp.to!int;
    int[][] a = new int[][](n, n);
    for (int i = 0; i < n; i++) {
        auto l = readln.chomp.split.map!(to!int);
        if (l[1] != 0) {
            foreach (e; l[2..l.length]) {
                a[l[0] - 1][e - 1] = 1;
            }
        }
    }

    foreach (r; a) {
        r.map!(to!string).join(" ").writeln;
    }
}