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 <bits/stdc++.h>
using namespace std;

int main() {
  int n;
  cin >> n;
  
  vector<vector<int> > A(n + 1, vector<int> (n + 1));
  
  int u, k;
  
  for (int i = 0; i < n; i++) {
    cin >> u >> k;
    for (int j = 0; j < k; j++) {
      int adju;
      cin >> adju;
      A.at(u - 1).at(adju - 1) = 1;
    }
  }
  
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      cout << A.at(i).at(j);
      if (j == n - 1) {
        cout << endl;
      }
      else {
        cout << " ";
      }
    }
  }
}

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

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

  for(int i=1;i<=n;i++){
    for(int j=1;j<=n;j++){
      cout<<graph[i][j]<<" ";
    }
    cout<<"\n";
  }
}

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

#define N 100
int A[N][N];
int u,k,v;

int main(void){
	
	int i,j;
	int n;
	cin >> n;	
	for(i=0;i<n;i++){
		for(j=0;j<n;j++){
			A[i][j] = 0;
		}
	}	

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

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




return 0;

}

C++: #include <iostream>

using namespace std;

int main(){
	int graph[101][101] = {0};
	int num;
	int hon;
	int eda;
	int ver;

	cin>>num;
	for(int i=0;i<num;i++){
		cin>>eda;
		cin>>hon;
		for(int j=0;j<hon;j++){
			cin>>ver;
			graph[eda][ver]++;
		}
	}
	for(int i=1;i<=num;i++){
		for(int j=1;j<=num;j++){
			cout<<graph[i][j];
			if(j==num)
				break;
			cout<<" ";
		}
		cout<<endl;
	}

	return 0;
}

C++: #include <bits/stdc++.h>
#define FOR(I,X,Y) for(long int I=X;I<Y;I++)
#define REP(I,X) for(long int I=X;I>=0;I--)
#define INF 1000000007
using namespace std;

int Adj[101][101];

int main(){
  int n,u,k,v;
  cin >> n;
  FOR(i,0,n){
    cin >> u >> k;
    FOR(j,0,k){
      cin >> v;
      Adj[u][v] = 1;
    }
  }
  FOR(i,1,n+1){
    FOR(j,1,n+1){
      if(j == n)cout << Adj[i][j];
      else cout << Adj[i][j] << " ";
    }
    cout << endl;
  }
}

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

int main(){
    //0 0 ??????????????\??????
    int M[N][N];
    int n,u,k,v;

    cin>>n;

    for(int i=0;i<n;i++)
        for(int j=0;j<n;j++)
            N[i][j]=0;

    for(int i=0;i<n;i++){
        cin>>u>>k;
        //??¬??¢???0??????
        u--;
        for(int j=0;j<k;j++){
            cin>>v;
            //??¬??¢???0??????
            v--;
            //??¨u???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<<endl;
    }
}

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

int main( void ){
  int M[N][N];
  int n,m,l,k;
 
  cin >> n;

  for( int i = 0 ; i < n ; i++ ){
    for( int j = 0 ; j < n ; j++ ){
      M[i][j];
    }
  }
  for( int i = 0 ; i < n ; i++ ){
    cin >> m >> l;
    m--;
    for( j = 0 ; j < n ; j++ ){
      cin >> k;
      k--;
      M[m][k]; = 1;
    }
  }
  for( int i = 0 ; i < n ; i++ ){
    for( int j = 0 ; j < n ; j++ ){
      if( j ) cout << " ";
      cout << M[i][j];
    }
    cout << endl;
  }
  return 0;
}

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

int n, u, k, v;
int G[101][101] = {0};

int main() {
	cin >> n;
	for (int i=0; i<n; ++i) {
		cin >> u >> k;
		while (k --) {
			cin >> v;
			G[u][v] = 1;
		}
	}
	for (int i=1; i<=n; ++i) {
		for (int j=1; j<=n; ++j) {
			cout << (j==1 ? "" : " ") << G[i][j];
		}
		cout << endl;
	}
	return 0;
}

C++: #include <stdio.h>
#define MAX 100

int main(){
  int graph[MAX][MAX];
  int i,n,a,b,c,j;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      graph[i][j]=0;
    }
  }
  for(i=0;i<n;i++){
    scanf("%d",&a);
    scanf("%d",&b);
    a--;
    for(j=0;j<b;j++){
      scanf("%d",&c);
      c--;
      graph[a][c]=1;
    }
  }
  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      if(j)
	printf(" ");
      printf("%d",graph[i][j]);
    }
    printf("\n");
  }

  return 0;
}

C++: #include <iostream>
#include <cstdio>
#define MAX 101

using namespace std;


int main(){
  int n; cin>>n;
  int a[MAX][MAX]={};
  for(int i=1;i<=n;i++){
    int u,k; cin>>u>>k;
    for(int j=0;j<k;j++){
      int v; cin>>v;
      a[i][v]=1;
    }
  }
  for(int r=1;r<=n;r++){
    for(int c=1;c<=n;c++){
      cout<<a[r][c];
      if(c==n){
        cout<<endl;
      }else{
        cout<<' ';
      }
    }
  }

}

C++: #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

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

  int n;
  cin >> n;

  vector<vector<bool>> G(n, vector<bool>(n, false));
  for (int i = 0; i < n; i++) {
    int u, k;
    cin >> u >> k;
    --u;

    for (int j = 0; j < k; j++) {
      int v;
      cin >> v;
      --v;

      G[u][v] = true;
    }
  }

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

      if (j != n - 1) cout << " ";
    }

    cout << endl;
  }

  return 0;
}