using System;
using System.Collections.Generic;
using System.Linq;
// Q036 グラフの表現 https://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_11_A&lang=jp
class Program
{
static string InputPattern = "InputX";
static List<string> GetInputList()
{
var WillReturn = new List<string>();
if (InputPattern == "Input1") {
WillReturn.Add("4");
WillReturn.Add("1 2 2 4");
WillReturn.Add("2 1 4");
WillReturn.Add("3 0");
WillReturn.Add("4 1 3");
//0 1 0 1
//0 0 0 1
//0 0 0 0
//0 0 1 0
}
else {
string wkStr;
while ((wkStr = Console.ReadLine()) != null) WillReturn.Add(wkStr);
}
return WillReturn;
}
static void Main()
{
List<string> InputList = GetInputList();
int N = int.Parse(InputList[0]);
int UB = N;
int[,] MatrixArr = new int[UB + 1, UB + 1];
int[] wkArr = { };
Action<string> SplitAct = pStr =>
wkArr = pStr.Split(' ').Select(X => int.Parse(X)).ToArray();
foreach (string EachStr in InputList.Skip(1)) {
SplitAct(EachStr);
int FromNode = wkArr[0];
int[] ToNodeArr = EachStr.Split(' ').Skip(2).Select(pX => int.Parse(pX)).ToArray();
foreach (int EachToNode in ToNodeArr) {
MatrixArr[FromNode, EachToNode] = 1;
}
}
for (int I = 1; I <= UB; I++) {
var WillOutList = new List<string>();
for (int J = 1; J <= UB; J++) {
WillOutList.Add(MatrixArr[I, J].ToString());
}
Console.WriteLine(string.Join(" ", WillOutList.ToArray()));
}
}
}