Go: package main

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

//util
var sc = bufio.NewScanner(os.Stdin)

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

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func printList(list []int) {
	n := len(list)
	buf := bufio.NewWriter(os.Stdout)
	for _, v := range list[0 : n-1] {
		buf.Write([]byte(fmt.Sprintf("%d ", v)))
	}
	buf.Write([]byte(fmt.Sprintf("%d\n", list[n-1])))
	buf.Flush()
}

func max(a, b int) int {
	if a > b {
		return a
	} else {
		return b
	}
}

func min(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}

//solve

const MAX = 100

var n int
var A [MAX + 1][MAX + 1]int

func main() {
	sc.Split(bufio.ScanWords)
	n = nextInt()
	for i := 0; i < n; i++ {
		u, k := nextInt(), nextInt()
		A[u-1][u-1] = 0

		//fmt.Println(u, k)
		if k > 0 {
			for j := 0; j < k; j++ {

				v := nextInt()
				A[u-1][v-1] = 1

			}
		}

	}

	for i := 0; i < n; i++ {
		printList(A[i][0:n])
	}

}

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

static const int NMAX = 100;
bool G[NMAX][NMAX];

int main() {
	int n; cin >> n;

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

	for (int i = 0; i < n; i++) {
		int deg; cin >> deg >> deg;
		for (int j = 0; j < deg; j++) {
			int p; cin >> p;
			G[i][p - 1] = true;
		}
	}

	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>
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( int j = 0 ; j < l ; 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;
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;
}