Go: package main

/*
グラフの表現 隣接行列による表現
*/

import (
	"bufio"
	"fmt"
	"log"
	"os"
	"strconv"
	"strings"
)

func main() {
	scanner := makeScanner(8192)
	n := eGetInt(scanner)
	g := make([][]int, n)
	for i := 0; i < n; i++ {
		g[i] = make([]int, n)
		ints := eGetInts(scanner)
		num := ints[0]
		for j := 0; j < ints[1]; j++ {
			g[num-1][ints[j+2]-1] = 1
		}
	}
	for i := 0; i < n; i++ {
		s := fmt.Sprint(g[i])
		fmt.Println(s[1 : len(s)-1])
	}
}

////////////////////////////////////////////////////////////////////////////////
// ライブラリ
////////////////////////////////////////////////////////////////////////////////
func makeScanner(maxByte int) *bufio.Scanner {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Buffer(make([]uint8, 0, 8192), maxByte)
	return scanner
}
func makeWordScanner() *bufio.Scanner {
	scanner := makeScanner(8192)
	scanner.Split(bufio.ScanWords)
	return scanner
}
func eGetLine(r *bufio.Scanner) string {
	if r.Scan() {
		return r.Text()
	}
	err := r.Err()
	if err != nil {
		log.Fatal(err)
	}
	// EOF
	return ""
}
func eGetInt(r *bufio.Scanner) int {
	line := eGetLine(r)
	return eAtoi(line)
}
func eGetInt64(r *bufio.Scanner) int64 {
	line := eGetLine(r)
	return eAtoInt64(line)
}
func eGetFields(r *bufio.Scanner) []string {
	line := eGetLine(r)
	return strings.Fields(line)
}
func eGetInts(r *bufio.Scanner) []int {
	fields := eGetFields(r)
	ints := make([]int, len(fields))
	for i := 0; i < len(ints); i++ {
		ints[i] = eAtoi(fields[i])
	}
	return ints
}
func eGetInt64s(r *bufio.Scanner) []int64 {
	fields := eGetFields(r)
	ints := make([]int64, len(fields))
	for i := 0; i < len(ints); i++ {
		ints[i] = eAtoInt64(fields[i])
	}
	return ints
}
func eGetChars(r *bufio.Scanner) []string {
	line := eGetLine(r)
	return strings.Split(line, "")
}
func eAtoi(s string) int {
	n, err := strconv.Atoi(s)
	if err != nil {
		log.Fatal(err)
	}
	return n
}
func eAtoInt64(s string) int64 {
	n, err := strconv.ParseInt(s, 10, 64)
	if err != nil {
		log.Fatal(err)
	}
	return n
}

C++: #include <iostream>
#include <vector>
#include <cassert>
#include <algorithm>
#include <functional>

using namespace std;
    
#include <iostream>
#include <vector>
#include <cassert>
#include <algorithm>
#include <functional>
#include <cmath>
#include <iomanip>
#include <limits>
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin >> n;
    vector<vector<int>> vec(n);
    vector<int> SIZE;
    for(int i=0;i<n;i++){
        int x;
        cin >> x;
        int num;
        cin >> num;
        SIZE.push_back(num);
        for(int j = 0;j< num;j++){
            int y;
            cin >> y;
            vec[x-1].push_back(y-1) ;
        }
    }
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            bool hantei=0;
            for(int k=0;k<SIZE[i];k++){
                if(vec[i][k]==j) {cout << 1 <<" "; hantei=1;}
            }
            if(hantei==0) cout <<0<<" ";
        }cout << endl;
    }cout << endl;
}cout << endl;

C++: #include <stdio.h>
#define rep(i, n) for(int i = 0; i < n; ++i)

int main(void) {
  int n, i, j;
  scanf("%d", &n);
  char r[n][n];
  rep(i, n) rep(j, n) r[i][j] = 0;
  rep(i, n) {
    int u, k;
    scanf("%d%d", &u, &k);
    u--;
    rep(j, k) {
      int v;
      scanf("%d", &v);
      v--;
      r[v][u] = 1;
    }
  }
  rep(i, n) {
    rep(j, n - 1) printf("%d ", r[i][j]);
    printf("%d\n", r[i][n - 1]);
  }
  return 0;
}

C++: #include<stdio.h>
#include<iostream>
using namespace std;

#define N 100

int main(){
int unp[N][N];
int n,u,k,v,i,j;

scanf("%d",&n);

for(i=0;i<n;i++){
  for(j=0;j<n;j++) unp[i][j]=0;
}

for(i=0;i<n;i++){
  scanf("%d %d",&u,&k);
  u--;

  for(j=0;j<k;j++){
    scanf("%d",&v);
    v--;
    unp[u][v]=1;
  }
}

for(i=0;i<n;i++){
  for(j=0;j<n;j++){
    if(j) cout << " ";
    cout << unp[i][j];
  }
  printf("\n");
}



  return 0;
}

C++: #include <iostream>
#include <string>
#include <map>
#include <set>
#include <algorithm>
using namespace std;
#define MAX 100000

int main(){
  int n;
  cin >>n;
  int A[n+2][n+2]={0};
  int t,k,l,
  for(int i=1;i<=n;i++){
    cin >> t >> k;
    for(int j=1;j<=k;j++){
      cin >> l;
      A[i][l]=1;
    }
  }
  for(int i=1;i<=n;i++){
    for(int j=1;j<=n;j++){
      cout << A[i][j];
    }
    cout << endl;
  }
  return 0;
}

C++: #include <iostream>
using namespace std;


static const int N=100;

int main()
{
    int M[N][N] //0 origin Adjacency matrix
    int n,u,k,v;

    cin　>> n;

    for(int i = 0; i < n; i++)
    {
        for(int j = 0; j < n; j++) M[i][j]=0;
    }

    for(int i = 0; i < n; i++)
    {
        cin >> u >> k;
        u--; //0 origin
        for(int j = 0; j < k; j++)
        {
            cin >> v;
            v--; //0 origin
            M[u][v]=1;//uとvの間に辺を張る
        }
    }


    for(int i = 0; i < n; j++)
    {
        for(int j = 0; j < n; j++)
        {
            if(j) cout << " ";
            cout << M[i][j];
        }
        cout << endl;
    }
    return 0;
}

C++: #include<stdio.h>

int main(){
  int i,j,n,k,c,b;

  int a[124][124]={{}};

  scanf("%d",&n);
  for(i=0;i<n;i++){

    scanf("%d %d",&c,&b);
    for(j=0;j<b;j++){
      scanf("%d",&k);
      a[c-1][k-1]=1;

    }
  }
  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
       printf("%d",a[i][j]);
      if(j!=0){
	printf(" ");
    
    }
    }
    
    puts("");
 
}
  return 0;
}

C++: #include<bits/stdc++.h>
#define REP(i,n) for(long long i=0;i<n;++i)
#define FOR(i,a,b) for(long long i=a;i<b;++i)
using namespace std;
int graph[101][101];
int main(){
    int n,u,k,v;
    scanf("%d",&n);
    fill(graph[0],graph[100],0);
    REP(i,n){
        scanf("%d%d",&u,&k);
        REP(j,k){
            scanf("%d",&v);
            graph[u][v]=1;
        }
    }
    REP(i,n){
        REP(j,n){
            if(j) printf(" ");
            printf("%d",graph[i+1][j+1]);
        }
        puts("");
    }
    return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;

int main() {
   int n, u, k, v, g[100][100];
   cin >> n;
   for(int i=0; i<n; i++) {
       for(int j=0; j<n; j++) {
           g[i][j]=0;
        }
    }
   for(int i=0; i<n; i++) {
       cin >> u >> k;
       for(int j=0; j<k; j++) {
           cin >> v;
           g[u-1][v-1]=1;
       }
    }
    for(int i=0; i<n; i++) {
        for(int j=0; j<n; j++) {
            if(j) cout << " ";
            cout << g[i][j];
        }
        cout << endl;
    }
}

C++: #include <bits/stdc++.h>
#define MAX 100
using namespace std;

int n;
int E[MAX][MAX];

int main()
{
	int n;
	cin >> n;
	for (int i = 0, u, k; i < n; i++) {
		cin >> u >> k;
		for (int j = 0, v; j < k; j++) {
			cin >> v;
			E[u - 1][v - 1] = 1;
		}
	}
	for (int i = 0; i < n; i++) {
		cout << E[i][0];
		for (int j = 1; j < n; j++) {
			cout << ' ' << E[i][j];
		}
		cout << endl;
	}
	return 0;
}

C++: #include <bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a), i##_max = (b); i < i##_max; ++i)
#define RFOR(i, a, b) for (int i = (b)-1, i##_min = (a); i >= i##_min; --i)
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define RREP(i, n) for (int i = (n)-1; i >= 0; --i)
#define ALL(obj) (obj).begin(), (obj).end()

using namespace std;
using vi = vector<int>;
using vd = vector<double>;
using i64 = int64_t;

constexpr int INF = 1 << 30;
constexpr int MOD = 1000000007;

template <typename T>
void print(vector<T> &v) {
  REP(i, v.size()) {
    if (i) cout << " ";
    cout << v[i];
  }
  cout << endl;
}

int main() {
  int n, u, k, v;
  cin >> n;
  vector<vi> adj(n, vi(n, 0));
  REP(i, n) {
    cin >> u >> k;
    REP(j, k) {
      cin >> v;
      adj[u - 1][v - 1] = 1;
    }
  }
  REP(i, n) print(adj[i]);
}