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 <iostream>
using namespace std;
static const int N = 100;

int main(){
  int n;
  int M[N][N];
  int 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--;
    for(int j = 0 ; j < k ; j++){
      cin >> v;
      v--;
      M[u][v] = 1;
    }
  }
  for(int i = 0 ; i< n ; i++){
    for(int j = 0 ; j < n ; j++){
      if(j) cout << " ";
      cout << M[i][j] ;
    }
    cout << "\n";
  }

  return 0;
}

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

int main(){
    int n;cin>>n;
    int M[n+1][n+1]={};//index 0 is not used.
    for(int i=1;i<n+1;i++){
        int target,degree;
        cin>>target>>degree;
        for(int j=0;j<degree;j++){
            int in;
            cin>>in;M[target][in]=1;
        }
    }
    for(int i=1;i<n+1;i++){
        for(int j=1;j<n+1;j++){
            cout<<M[i][j];
            if(j != n)cout<<" ";
        }
        cout<<endl;
    }
    return 0;
}

C++: #include<iostream>
#define FOR(i,n) for(int i=0;(i)<(n);(i)++)
using namespace std;
int G[101][101] = {};

int main()
{
	int n;
	cin >> n;
	FOR(i, n)
	{
		int m,u;
		cin >> u >> m;
		FOR(j, m)
		{
			int l;
			cin >> l;
			G[u-1][l-1] = 1;
		}
	}
	FOR(i, n)
	{
		FOR(j, n)
		{
			cout << G[i][j] << " ";
		}
		cout << endl;
	}
	return 0;
}

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

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

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

int main(){

  int n,k,v,u;
  cin>>n;

  double V[n][n];

  for(int i=0;i<n;i++){
    for(int j=0;j<n;j++){

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


  }

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

  return 0;
}

C++: #include <iostream>
using namespace std;
static int N = 200;

int main(){
    int G[N][N] = {{0}};
    int n, id, k, adj;
    cin >> n;

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

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

    return 0;
}

C++: #include <iostream>
using namespace std;
int main(){
        int N;
        cin >> N;
        int lt[200][200]={0};
        for( int i=0 ; i<N ; i++ ){
                int x,y,n;
                cin >> x >> n;
                for(int l=0 ; l<n ; l++ ){
                        cin >> y;
                        lt[x-1][y-1]=1;
                }
        }
        for(int i=0;i<N;i++){
                for(int j=0;j<N;j++){
                        cout<<lt[i][j];
                        if(j!=N-1)cout<<" ";
                }
                cout<<endl;
        }
        return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
    int n,k,a,u,V[200][200];
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>a>>k;
        for(int j=1;j<=k;j++){
            cin>>u;
            V[a][u]++;
        }
    }
    for(int i=1;i<=n;i++){
        for(int j=1;j<=n;j++){
            if(j==1) cout<<V[i][1];
            else cout<<" "<<V[i][j];
        }
        cout<<endl;
    }
}

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

int main () {
    int n;
    cin >> n;
    int M[n][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++){
        int id, k;
        cin >> id >> k;
        for (int j = 0; j < k; j++){
            int tmp;
            cin >> tmp;
            M[i][tmp-1] = 1;
        }
    }
    for (int i = 0; i< n; i++){
        for (int j = 0; j < n; j++){
            if (j < n - 1){
                cout << M[i][j] << " ";
            } else {
                cout << M[i][j] << endl;
            }
            
        }
    }
    return 0;
}

C++: #include<iostream>

using namespace std;

static const int N = 100;

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

  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;
     u--;
     for(int j = 0; j < k; j++){
       cin >> v;
     v--;
     G[u][v] = 1;
   }
}

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

   return 0;
}

C++: #include <iostream>
#include <string>
#include <vector>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <functional>
#include <map>
#include <cmath>
#include <queue>

using namespace std;

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

    int n;scanf("%d",&n);
    int u;
    int k;
    vector<vector<int> > graph;
    graph.resize(n);
    for(int i=0;i<n;i++){
        graph[i].resize(n);
    }
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            graph[i][j]=0;
        }
    }

    for(int i=0;i<n;i++){
        scanf("%d",&u);
        scanf("%d",&k);
        int value;
        for(int j=0;j<k;j++){
            scanf("%d",&value);
            graph[u-1][value-1]=1;
        }
    }

    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            printf("%d ",graph[i][j]);
        }
        printf("\n");
    }

    return 0;
}