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 <map>
#include <set>
#include <list>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <numeric>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <functional>

#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define repi(i,a,b) for(int i = (a); i < (b); i++)

using namespace std;

typedef    long long          ll;
typedef    unsigned long long ull;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      pii;

const int INF=1<<29;
const double EPS=1e-9;

const int dx[]={1,0,-1,0},dy[]={0,-1,0,1};
int n;
int d[120][120];
int main(){
	cin>>n;
	for(int i =0;i < n;i++){
		int u,k;
		cin>>u>>k;
		for(int j =0;j <k;j++){
			int c;
			cin>>c;
			d[u][c]=1;
		}
	}
	for(int i =1;i <=n;i++){
		for(int j =1;j <=n;j++){
			if(j==1)cout <<d[i][j];
			else cout <<" "<<d[i][j];
		}
		cout <<endl;
	}
	return 0;
}

C++: #include <cstdio>
#include <cstdlib>
#include <string>
#include <iostream>

using namespace std;
static const int N=100;

int main()
{
    int n,k,v,u,j,i;
    int Adj[N+1][N+1]={0};

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

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

int main(void){
  int m, a[100][100];
  int b[100][100]={0};

  cin >> m;

  for(int i=0; i<m; i++){
    cin >> a[i][0];
    cin >> a[i][1];

    for(int j=2; j<a[i][1]+2; j++){
      cin >> a[i][j];
      b[i][ a[i][j]-1 ] = 1;
    }
  }

  for(int i=0; i<m; i++){
    for(int j=0; j<m; j++){
      cout << b[i][j] << " ";
    }
    cout << "\n";
  }
  return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
static const int N = 100;

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

    scanf("%d",&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 ){
        scanf("%d %d",&u,&k);
        u--;
        for( int j = 0; j < k; ++j ){
            scanf("%d",&v);
            v--;
            M[u][v] = 1;
        }
    }

    for( int i = 0; i < n; ++i ){
        for( int j = 0; j < n; ++j ){
            if( j ) putchar(' ');
            printf("%d",M[i][j]);
        }
        puts("");
    }

    return 0;
}

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

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

  cin >> n;

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

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

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

  return 0;
}

C++: #include <bits/stdc++.h>

#define REP(i, s, n) for (int i = s; i < n; i++)
#define rep(i, n) REP(i, 0, n)

using namespace std;

// graph
// adjacent list
vector<vector<int>> G; 
// adjacent matrix
const int MAX_N = 100;
int GM[MAX_N][MAX_N];

int main(){
    // input 
    int n; cin >> n;
    G.resize(n);
    rep(i, n){
        int from, edgeNum, to;
        cin >> from >> edgeNum;
        G[from-1].resize(edgeNum);
        rep(j, edgeNum){
            cin >> G[from-1][j];
        }
    }

    // output adjacent matrix
    rep(u, n){
        rep(i, G[u].size()){
            GM[u][G[u][i]-1] = 1; 
        }
    }
    rep(i, n)
        rep(j, n)
            cout << GM[i][j] << (j<n-1? " ": "\n");
}

C++: #include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <utility>
#include <queue>
#include <string>
#include <climits>
using namespace std;

#define MAX_N 101


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

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

int main(){
        int N;
        cin >> N;
        int a[110][110]={{0}};
        for(int i=0; i<N; i++){
                int v,n;
                cin >> v;
                cin >> n;
                for(int j=0; j<n; j++){
                        int V;
                        cin >> V;
                        a[v-1][V-1]=1;
                }
        }
        for(int i=0; i<N; i++){
                for(int j=0; j<N; j++){
                        cout << a[i][j];
                }
                cout << endl;
        }
}

C++: #define scanf_s scanf
#include <string>
#include <stdio.h>
#include <math.h>
#include <stack>
#include <queue>
#include <list>
#include <vector>
#include <iostream>
using namespace std;

#define MAX 100
//#define MAX_ 1000
int main(void)
{
	int G[MAX][MAX] = { false };
	int n, u, k, v;
	scanf_s("%d", &n);
	for (int i = 0; i < n; ++i) {
		scanf_s("%d %d", &u, &k);
		for (int j = 0; j < k; ++j) {
			scanf_s("%d", &v);
			G[u - 1][v - 1] = true;
		}
	}
	for (int i = 0; i < n; ++i) {
		for (int j = 0; j < n; ++j) {
			if (j != 0) printf(" ");
			printf("%d", G[i][j]);
		}
		if (i != n - 1) printf("\n");
	}
}

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;
}