Go: package main

import (
	"bufio"
	"bytes"
	"fmt"
	"io"
	"os"
	"strconv"
	"strings"
)

const N = 100

func answer(reader io.Reader) string {
	sc := bufio.NewScanner(reader)
	sc.Split(bufio.ScanWords)

	sc.Scan()
	n, _ := strconv.Atoi(sc.Text())

	var M [N][N]int
	for i := 0; i < n; i++ {
		sc.Scan()
		u, _ := strconv.Atoi(sc.Text())
		sc.Scan()
		k, _ := strconv.Atoi(sc.Text())
		u--
		for j := 0; j < k; j++ {
			sc.Scan()
			v, _ := strconv.Atoi(sc.Text())
			v--
			M[u][v] = 1
		}
	}

	var out bytes.Buffer
	for i := 0; i < n; i++ {
		for j := 0; j < n; j++ {
			if j != 0 {
				out.WriteString(" ")
			}
			out.WriteString(fmt.Sprintf("%d", M[i][j]))
		}
		out.WriteString("\n")
	}

	return strings.TrimRight(out.String(), "\n")
}

func main() {
	fmt.Println(answer(os.Stdin))
}

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

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

	cin >> n;

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

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

	for ( i = 0; i < n; i++ ) {
		for ( j = 0; j < n; j++ ) {
			if( j ) cout << " ";
			cout << M[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() {


    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]);
        }
        if(i!=n-1) {
            printf("\n");
        }
    }

    return 0;
}

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

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

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

  int u, k;
  cin >> u >> k;
  for(int i=0;i<k;i++){
    mat[u-1][k-1]=1;
  }

  for(int i=0;i<n;i++){
    cout << mat[i-1][0];
    for(int j=1;j<n;j++)
      cout << ' ' << mat[i-1][j];
    cout << endl;
  }
}

C++: #include <iostream>
#include <vector>

int main(){
    int n;
    std::cin >> n;
    std::vector<int> Adj[n];
    //input_graph
    int u, k, v;
    for(int i=0; i<n; i++){
        std::cin >> u >> k;
        for(int j=0; j<k; j++){
            std::cin >> v;
            Adj[u-1].push_back(v);
        }
    }

    //input_A
    int A[n][n] = {0};
    for(int i=0; i<n; i++){
        int len = Adj[i].size();
        for(int j=0; j<len; j++){
            A[i][Adj[i][j]-1] = 1;
        }
    }

    //output_A
    for(int i=0; i<n; i++){
        for(int j=0; j<n; j++){
            if(j+1==n)  std::cout << A[i][j] << '\n';
            else        std::cout << A[i][j] << " ";
        }
    }
    return 0;
}

C++: include<iostream>
#include<cstdio>
#define N 101
using namespace std;

int main(){

  int n,n2,data,u;
  int g[N][N]; 
 //load n
  cin >>n;

  //initialize
  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++){
    scanf("%d%d",&u,&n2);
    for(int j=0;j<n2;j++){
      scanf("%d",&data);
      g[u][data]=1;
    }
  }

  for(int i=1;i<=n;i++){
    for(int j=1;j<=n;j++){
      printf("%d",g[i][j]);
      if(j!=n)printf(" ");
    }
    printf("\n");
  }

  return 0;
}

C++: #include<bits/stdc++.h>
#define N 105
using namespace std;
int n,u,k,v,e[N][N];

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

C++: #include<iostream>
using namespace std;
int main(){
	int n;
	cin>>n;
	int a[100][100]={0};
	for(int l=0; l<n; l++){
		int v,k;
		cin>>v>>k;
		int u;
		for(int i=0; i<k; i++){
			cin>>u;
			a[v-1][u-1]=1;
		}
	}
	for(int i=0; i<n; i++){
		for(int j=0; j<n-1; j++){
			cout<<a[i][j]<<" ";
		}
		cout<<a[i][n-1]<<endl;
	}
	return 0;
}

C++: #include <iostream>
#include <vector>

#define REP(i,n) for (int i=0;i<(n);i++)
using namespace std;

int n;
typedef vector<vector<int> > AdjMatrix;
AdjMatrix graph;


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

    REP(i, n){
        REP(j, n-1){
            cout << graph[i][j] << " ";
        }
        cout << graph[i][n-1] << endl;
    }
    return 0;
}

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

int main(){
    int n,k,u,v,M[LEN+1][LEN+1];
    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;
        for(int j=0;j<k;j++){
            cin>>v;
            M[u-1][v-1]=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<bits/stdc++.h>
using namespace std;

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

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

int main(){
    int n;
    cin>>n;
    vector<int> ans(101);
    for(int i=0;i<n;i++){
        ans[i]=0;
    }
    for(int i=0;i<n;i++){
        int x;
        cin>>x;
        int y;
        cin>>y;
        int z;
        for(int j=0;j<y;j++){
            cin>>z;
            ans[z-1]=1;
        }
        for(int k=0;k<n;k++){
            cout<<ans[k]<<flush;
            if(k<n-1){
            	cout<<' '<<flush;
            }
        }
        for(int j=0;j<n;j++){
        ans[j]=0;
    }
    if(i<n){
    cout<<endl;
    }
    }
    return 0;
}

C++: #include <iostream>
using namespace std;
int main(){
  int n,a,b,c;
  int G[200][200];

  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 >> a >> b;
    a--;
    for(int i = 0 ; i < b ; i++){
      cin >> c;
      c--;
      G[a][c] = 1;
    }
  }
  for(int i = 0 ; i < n ; i++){
    for(int j = 0 ; j < n ; j++){
      if(j == 0)cout << G[i][j];
      else cout <<" "<< G[i][j];
    }
    cout << endl;
  }
  return 0;
}

C++: #include<iostream>
#include<vector>
using namespace std;
int main(){
	int n;
	cin >> n;
	vector<vector<int>>adj(n, vector<int>(n));
	for (int i = 0;i < n;i++) {
		int u, k;
		cin >> u >> k;
		for (int j = 0;j < k;j++) {
			int v;
			cin >> v;
			adj[u - 1][v - 1] = 1;
		}
	}
	for (int i = 0;i <n;i++) {
		for (int j = 0;j <n;j++) {
			if (j == 0) {
				cout << adj[i][j];
			}
			else {
				cout << " " << adj[i][j];
			}

		}
		cout << endl;
	}

}

C++: #include<iostream>
using namespace std;
int v[101][101] = { 0 };
int main() {
	int n; cin >> n;
	int u, k;
	for (int i = 1; i <= n;i++) {
		cin >> u >> k;
		for (int j = 0; j < k;j++) {
			int t; cin >> t;
			v[u][t] = 1;
		}
	}
	for (int i = 1; i <= n;i++) {
		for (int j = 1; j <= n;j++) {
			if (j != n) {
				cout << v[i][j] << ' ';
			}else{
				cout << v[i][j] << endl;
			}
		}
	}
}