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 <array>
#include <vector>
#include <deque>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <string>
#include <algorithm>
#include <numeric>
#include <functional>
#include <iterator>
#include <tuple>
#include <utility>
#include <limits>
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cstdint>
#include <cassert>

using namespace std;

#define FOR(i, start, end) for(int i = (start); i < (end); ++i)
#define REP(i, n) FOR(i, 0, n)



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

    int mat[100][100];
    REP(i, n) {
        REP(j, n) {
            mat[i][j] = 0;
        }
    }

    REP(_, n) {
        int u, k;
        cin >> u >> k;

        REP(_, k) {
            int v;
            cin >> v;
            mat[u-1][v-1] = 1;
        }
    }

    REP(i, n) {
        REP(j, n) {
            cout << mat[i][j];
            cout << (j == n-1 ? '\n' : ' ');
        }
    }

    return 0;
}

C++: #include <stdio.h>
#define N 101

int main() {

  int n,i,k,l,j,u,a[N][N],v[N];
  scanf("%d",&n);
  for(i=1;i<=n;i++) {
    for(j=1;j<=n;j++){
      a[i][j] = 0;
    }
  }

  for(i=0;i<n;i++){
    scanf("%d",&u);
    scanf("%d",&k);
    while(k>0){
      scanf("%d",&l);
      a[u][l] = 1;
      k--;
    }
  }

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

  
  return 0;
}

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

int main(){
  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++)
      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 << endl;
  }

  return 0;
}

C++: #define _CRT_SECURE_NO_WARNINGS
#include <cstdio>
#include <cstdlib>
#include <string>
#include <iostream>
#include <climits>

using namespace std;


int main() {
	int n;
	int u, v;
	int Adj[101][101];
	int deg;
	cin >> n;
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= n; j++) {
			Adj[i][j] = 0;
		}
	}
	for (int i = 1; i <= n; i++) {
		cin >> u;
		cin >> deg;
		for (int j = 1; j <= deg; j++) {
			cin >> v;
			Adj[u][v] = 1;
		}
	}
	for(int i = 1; i <= n; i++) {
		for (int j = 1; j <= n; j++) {
			printf(" %d", Adj[i][j]);
		}
		printf("\n");
	}
}

C++: #include <iostream>

using namespace std;

int main()
{
    int n;
    cin >> n;
    int g[n + 1][n + 1];
    //?????????
    for (int i = 1; i <= n; i++) {
	for (int j = 1; j <= n; j++) {
	    g[i][j] = 0;
	}
    }
    //input
    for (int i = 1; i <= n; i++) {
	int a;
	cin >> a;
	int b;
	cin >> b;
	for (int j = 1; j <= b; j++) {
	    int c;
	    cin >> c;
	    g[a][c] = 1;
	}
    }
    for (int i = 1; i <= n; i++) {
	for (int j = 1; j <= n; j++) {
	    cout << g[i][j] << " ";
	}
	cout << endl;
    }
    return 0;
}

C++: #include<iostream>
using namespace std;
int a[101][101];
void init(int n){
	for (int i = 1;i <= n;i++){
		for (int j = 1;j <= n;j++){
			a[i][j] = 0;
		}
	}
}
int main()
{
	int n;
	while (cin >> n){
		init(n);
		int x,m,y;
		for (int i = 1;i <= n;i++){
			cin >> x >> m;
			while (m--){
				cin >> y;
				a[x][y] = 1;
			}
		}
		for (int i = 1;i <= n;i++){
			for (int j = 1;j <= n;j++){
				cout << a[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, 0));
    for (int i = 0; i < n; i++)
    {
        int a, k;
        cin >> a >> k;
        for (int j = 0; j < k; j++)
        {
            int x;
            cin >> x;
            adj[a - 1][x - 1] = 1;
        }
    }

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

    return 0;
}

C++: #include <iostream>

using namespace std;

int main(){
  int g[1001][1001]={{0}};//要素を0で初期化
  int n,a,b,c;
  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 ;
    for (int i = 0; i < b; ++i)
    {
      cin >> c;
      g[a-1][c-1]=1;/* code */
    }
  }
  for (int i = 0; i < n; ++i)
  {
     for (int j = 0; j < n; ++j)
     {
      if (j==n-1)
      {
        cout << g[i][j] << endl;
      }else{
        cout << g[i][j] <<" ";
      }
     }
  }

}

C++: #include<cstdio>
#include<iostream>
using namespace std;
int n, adj[101][101];

int main()
{
  scanf("%d", &n);
  int u, k, v;
  for(int i=0; i<=n; i++)
  {
    for(int j=0; j<=n; j++)
    {
      adj[i][j] = 0;
    }
  }
  for(int i=0; i<n; i++)
  {
    scanf("%d%d", &u, &k);
    for(int j=0; j<k; j++)
    {
      scanf("%d", &v);
      adj[u][v] = 1;
    }
  }
  for(int i=1; i<=n; i++)
  {
    for(int j=1; j<=n; j++)
    {
      if(j!=1) printf(" ");
      printf("%d", adj[i][j]);
    }
    printf("\n");
  }



  return 0;
}

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

int main(){
    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++) 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 << endl;
    }
    
    return 0;
}

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

int main()
{
    int n,k;
    int A[100][100]={0};
    cin>>n;
    for(int i=0;i<n;i++)
    {
        cin>>k;
        for(int j=0;j<k;j++)
        {
            int x;
            cin>>x;
            A[i][x]=1;
        }
    }
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            if(i==n-1&&j==n-1)
                cout<<A[i][j];
            else
                cout<<A[i][j]<<" ";
        }
    }
    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;
	}

}