Go: package main

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

func getScanner(fp *os.File) *bufio.Scanner {
	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 500001), 500000)
	return scanner
}

func getNextString(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}

func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}

func main() {
	fp := os.Stdin
	if len(os.Args) > 1 {
		fp, _ = os.Open(os.Args[1])
	}

	scanner := getScanner(fp)
	writer := bufio.NewWriter(os.Stdout)

	n := getNextInt(scanner)
	g := make([][]int, n)

	for i := 0; i < n; i++ {
		g[i] = make([]int, n)
	}

	for i := 0; i < n; i++ {
		u := getNextInt(scanner)
		k := getNextInt(scanner)
		u--
		for ii := 0; ii < k; ii++ {
			v := getNextInt(scanner)
			v--
			g[u][v] = 1
		}
		fmt.Fprintln(writer, joinint(g[u], " "))
	}

	writer.Flush()
}

func joinint(a []int, sep string) string {
	n := len(a)
	ss := make([]string, n)
	for i := 0; i < n; i++ {
		ss[i] = fmt.Sprintf("%d", a[i])
	}
	return strings.Join(ss, sep)
}

C++: #include<cstdlib>
#include<cstdio>
#include<algorithm>
using namespace std;
const int MAXN = (int)1e2 + 10;

int n;
int a[MAXN][MAXN];

void work(){
    scanf("%d",&n);
    for(int i=1;i<=n;i++){
        int u,k; scanf("%d%d",&u,&k);
        for(int j=1;j<=k;j++){
            int v; scanf("%d",&v);
            a[u][v]=1;
        }
    }
    for(int i=1;i<=n;i++){
        printf("%d",a[i][1]);
        for(int j=2;j<=n;j++) printf(" %d",a[i][j]);
        printf("\n");
    }
}

int main(){
    work();
    return 0;
}

C++: #include<bits/stdc++.h>
#define MAX 101
using namespace std;

int G[MAX][MAX]={};

void print(int n){
  for(int i=1;i<=n;i++){
    for(int j=1;j<=n;j++){
      if(j!=n)cout<<G[i][j]<<" ";
      else cout<<G[i][j];
    }
    cout<<endl;
  }
}
  
int main(){
  int n,i,k,j,A,B;
  cin>>n;
  for(i=0;i<n;i++){
    cin>>A>>k;
    for(j=0;j<k;j++){
      cin>>B;
      G[A][B]=1;
    }
  }
  print(n);
}

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

static const int Q = 1000;

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

  cin >> n;

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

// 総数を1000000007で割った余り
const long long mod = 1e9 + 7;

using ll  = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define SORT(v, n) sort(v, v + n);
// #define SORT(v, n) stable_sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

ull gcd(ull a, ull b) { return b ? gcd(b, a % b) : a; }
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }

int n = 100;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    // cout << fixed << setprecision(5);

    int m[n][n];
    int n, u, k, v;
    cin >> n;
    rep(i, n) {
        rep(j, n) { m[i][j] = 0; }
    }

    rep(i, n) {
        cin >> u >> k;
        u--;  // 0-indexに変換
        rep(j, k) {
            cin >> v;
            v--;          // 0-indexに変換
            m[u][v] = 1;  // uとvの間に辺を張る。
        }
    }
    rep(i, n) {
        rep(j, n) {
            if (j) cout << " ";
            cout << m[i][j];
        }
        cout << endl;
    }

    return 0;
}

C++: #include<stdio.h>
typedef struct{
  int u;
  int k;
  int v[100];
}Graph;

main(){
  int i,j,n;
  int a[100][100];
  Graph node[100];
  scanf("%d",&n);

  for(i=0;i<n;i++){
    scanf("%d",&node[i].u);
    scanf("%d",&node[i].k);
    for(j=0;j<node[i].k;j++)scanf("%d",&node[i].v[j]);
  }

  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      a[i][j]=0;
    }
    for(j=0;j<node[i].k;j++){
      a[i][node[i].v[j]-1] = 1;
    }
  }
  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      printf("%d",a[i][j]);
    }
    if(i<n)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;
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>
#include<vector>
using namespace std;

int main(){
  vector<vector<int> > graph;
  int n;

  cin >> n;
  graph.resize(n);
  for(int i=0;i<n;i++){
    graph[i].resize(n);
    for(int j=0;j<n;j++){
      graph[i][j]=0;
    }
  }

  for(int i=0;i<n;i++){
    int idx,times;

    cin >> idx >> times;
    for(int j=0;j<times;j++){
      int path;

      cin >> path;
      graph[idx-1][path-1]=1;
    }
  }

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

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