Go: package main

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

// I/O
type Scanner struct {
	sc *bufio.Scanner
}

func NewScanner() *Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &Scanner{sc}
}

func (s *Scanner) nextStr() string {
	s.sc.Scan()
	return s.sc.Text()
}

func (s *Scanner) nextInt() int {
	i, e := strconv.Atoi(s.nextStr())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *Scanner) nextFloat() float64 {
	f, e := strconv.ParseFloat(s.nextStr(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

func (s *Scanner) nextRuneSlice() []rune {
	return []rune(s.nextStr())
}

func (s *Scanner) nextIntSlice(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextInt()
	}
	return res
}

func (s *Scanner) nextFloatSlice(n int) []float64 {
	res := make([]float64, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextFloat()
	}
	return res
}

// Arithmetic
func max(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m < i {
			m = i
		}
	}
	return m
}

func min(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m > i {
			m = i
		}
	}
	return m
}

func abs(x int) int {
	if x > 0 {
		return x
	}
	return -x
}

func pow(x, y int) int {
	res := 1
	for i := 0; i < y; i++ {
		res *= x
	}
	return res
}

func ceil(a, b int) int {
	if a%b == 0 {
		return a / b
	} else {
		return a/b + 1
	}
}

// Sort
type RuneSlice []rune

func (a RuneSlice) Len() int           { return len(a) }
func (a RuneSlice) Less(i, j int) bool { return a[i] < a[j] }
func (a RuneSlice) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }

// Main
func main() {
	sc := NewScanner()
	wtr := bufio.NewWriter(os.Stdout)
	N := sc.nextInt()
	g := make([][]int, N)
	for i, _ := range g {
		g[i] = make([]int, N)
	}
	for i := 0; i < N; i++ {
		u, k := sc.nextInt(), sc.nextInt()
		for j := 0; j < k; j++ {
			g[u-1][sc.nextInt()-1] = 1
		}
	}

	for _, r := range g {
		for i, num := range r {
			if i > 0 {
				fmt.Fprint(wtr, " ")
			}
			fmt.Fprint(wtr, num)
		}
		fmt.Fprintln(wtr)
	}
	wtr.Flush()
}

C++: #include <stdio.h>

#define NMAX 100

int main() {
    int M[NMAX + 1][NMAX + 1];
    int n, k, a, b;
    scanf("%d", &n);
    for (int i = 1; i <= n; i++)
        for (int j = 1; j <= n; j++)
            M[i][j] = 0;
    for (int i = 0; i < n; i++) {
        scanf("%d %d", &a, &k);
        for (int j = 0; j < k; j++) {
            scanf("%d", &b);
            M[a][b] = 1;
        }
    }
    for (int i = 1; i <= n; i++)
        for (int j = 1; j <= n; j++)
            printf("%d%c", M[i][j], j == n ? '\n' : ' ');
    return 0;
}

C++: //Graph
#include <iostream>

using namespace std;

int main() {
    int n, u, k, v;
    cin >> n;
    int M[n+1][n+1];
    for(int i=0; i<n+1; i++)
        for(int j=0; j<n+1; j++)
            M[i][j] = 0;

    for(int i = 0; i < n; i++) {
        cin >> u >> k;
        for(int j = 0; j < k; j++) {
            cin >> v;
            M[u][v] = 1;
        }
    }
    for(int i=1; i<n+1; i++) {
        for(int j=1; j<n; j++)
            cout << M[i][j] << " ";
        cout << M[i][n] << endl;
    }
}

C++: #include<iostream>
using namespace std;
int a[110][110];
int main(){
    int n;
    scanf("%d",&n);
    for(int i=0;i<n;i++)
        for(int j=0;j<n;j++)
            a[i][j] = 0;
    for(int i=0;i<n;i++){
        int u,k,v;
        scanf("%d%d",&u,&k);
        while(k--){
            scanf("%d",&v);
            a[u-1][v-1] = 1;
        }
    }
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            if(j) printf(" ");
            printf("%d",a[i][j]);
        }
        printf("\n");
    }
    return 0;
}

C++: #include "bits/stdc++.h"
using namespace std;
int main()
{
    int n;
    scanf("%d", &n);
    vector<vector<int>> a(n, vector<int>(n, 0));
    for (int i = 0, u, k; i < n; i++)
    {
        scanf("%d %d", &u, &k);
        u--;
        for (int j = 0, v; j < k; j++)
        {
            scanf("%d", &v);
            a[u][--v] = 1;
        }
    }
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < n; j++)
        {
            printf("%d%s", a[i][j], j != n - 1 ? " " : "\n");
        }
    }
}

C++: #define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <list>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <queue>
#include <iomanip>
#define INF 2147483647
 
using namespace std;

int main(void)
{
	int n, k, u, v;
	int G[101][101];

	cin >> n;

	memset(G, 0, sizeof(G));

	for (int i = 0; i < n; i++) {
		cin >> u >> k;
		for (int j = 0; j < k; j++) {
			cin >> v;
			G[u][v] = 1;
		}
	}

	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= n; j++) {
			cout << G[i][j];  
			if (n != j)cout << " "; 
		}
		cout << endl;
	}

	return (0);
}

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

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

}

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[u][v] = 1;
    }
  }
  rep(i, n) {
    rep(j, n - 1) printf("%d ", r[i][j]);
    printf("%d\n", r[i][n - 1]);
  }
  return 0;
}

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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  int n;
  cin >> n;

  int G[101][101];
  int u, v, k;

  for (int i = 1; i <= n; i++) {
    for (int j = 1; 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][v] = 1;
    }
  }

  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      if (j != 1) cout << " ";
      cout << G[i][j];
    }
    cout << endl;
  }

  return 0;
}

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

int n;
int M[101][101];
int main() {
    cin >> n;

    for (int i = 0; i < n; ++i) {
        int v, k;
        cin >> v >> k;
        for (int j = 0; j < k; ++j) {
            int s;
            cin >> s;
            M[v][s] = 1;
        }
    }

    for (int l = 1; l <= n; ++l) {
        for (int i = 1; i <= n; ++i) {
            cout << M[l][i] << " " ;
        }
        cout << endl;
    }

    return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
#define P(x) cout << (x) << endl
#define p(x) cout << (x)
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define vv(type, c, m, n, i) vector<vector<type>> c(m, vector<type>(n, i));
#define rep(i,a,n) for(int i=(a), i##_len=(n); i<i##_len; ++i)
#define rrep(i,a,n) for(int i=(a), i##_len=(n); i>i##_len; --i)
#define len(x) ((int)(x).size())
#define mp make_pair
#define eb emplace_back
typedef long long ll;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<long long> vll;
typedef vector<string> vs;
typedef vector<bool> vb;
int main() {
	int n; cin >> n;
	vv(int, v, n + 1, n + 1, 0);
	int index, num, k;
	rep(i, 0, n) {
		cin >> index >> num;
		rep(j, 0, num) {
			cin >> k;
			++v[index][k];
		}
	}
	rep(i, 1, n + 1) {
		rep(j, 1, n + 1) {
			cout << v[i][j] << (j == n ? "\n" : " ");
		}
	}
	return 0;
}