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<iostream>
#include<stdio.h>

using namespace std;

int main() {
	int n,u,k,v; //頂点数、頂点の番号、出次数、隣接する頂点の番号
	int M[101][101];

	//初期化
	for (int i = 0;i < 101;i++) {
		for (int j = 0;j < 101;j++) {
			M[i][j] = 0;
		}
	}

	cin >> n;
	for (int i = 0;i < n;i++) {
		cin>>u >> k;
		for (int j = 0; j < k;j++) {
			cin >> v;
			M[u][v] = 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>
#include <iomanip>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <utility>
#include <string>
#include <cmath>
#include <cstdlib>
#include <cstring>

using namespace std;

typedef uint64_t u64;
typedef int64_t s64;
typedef uint32_t u32;
typedef int32_t s32;
typedef vector<s32> vs32;
typedef vector<u32> vu32;
typedef vector<s64> vs64;
typedef vector<u64> vu64;

const double PI=3.14159265358979323846;

#define MAX(x, y) ((x) < (y) ? (y) : (x))
#define MIN(x, y) ((x) > (y) ? (y) : (x))

#define rep(i, N) for(int i = 0; i < N; ++i)

#define CEIL(x, y) (((x) + (y) - 1) / (y))
#define MOD 1000000007ULL

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n;
    cin >> n;

    vector< vs32 > a(n, vs32(n, 0));
    int u, v;
    int c;
    rep (i, n)
    {
        cin >> u >> c;
        --u;
        rep (i, c)
        {
            cin >> v;
            --v;
            a[u][v] = 1;
        }
    }

    rep (i, n)
    {
        rep (j, n)
        {
            if (j > 0)
            {
                cout << " ";
            }
            cout << a[i][j];
        }
        cout << "\n";
    }

    return 0;
}

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

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

C++: #include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <ctime>
#include <cstring>
using namespace std;

int n;


int main(void){

	cin >> n;
	int suji[n];
	int	num[n];
	int adj[n][num];
	int ans[n][n];

	

	for(int i = 0; i < n; i++){
		
		cin >> suji[i] >> num[i];

		
		for(int j = 0; j < num[i]; j++){
			cin >> adj[i][j];
			adj[i][j] -= 1;
		}
	}

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

	for(int i = 0; i < n; i++){
		for(int j = 0; j < num[i]; j++){
			ans[i][adj[i][j]] = 1;
		}
	}

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



	
    return 0;
}

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

int main() {
    int n, tmp, node;
    cin >> n;
    int ver[n+1][n+1] = {};
    for (int i=1; i<=n; i++) {
        cin >> tmp;
        cin >> tmp;
        for (int j=0; j<tmp; j++) {
            cin >> node;
            ver[i][node] = 1;
        }
    }
    for (int i=1; i<=n; i++) {
        for (int j=1; j<n; j++) {
            cout << ver[i][j] << " ";
        }
        cout << ver[i][n] << endl;
    }
}

C++: #include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(n) begin(n), end(n)
using ll = long long;
using namespace std;

int main(){
  int n;
  cin >> n;
  vector<vector<int>> gr(n, vector<int>(n,0));
  rep(i, n){
    int nn;
    cin >> nn;
    int num;
    cin >> num;
    rep(j, num){
      int a;
      cin >> a;
      a--;
      gr.at(i).at(a)++;
    }
  }
  rep(i, n){
    rep(j, n){
      if(j != 0) cout << " ";
      cout << gr.at(i).at(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>
using namespace std;
int main(){
    int N;
    int u[101],k[101],a[101],d[101][101];
    memset(d,0,sizeof(d));
    cin>>N;
    for(int i=0;i<N;++i){
        cin>>u[i]>>k[i];
        for(int j=0;j<k[i];++j){
            cin>>a[j];
            d[u[i]][a[j]]=1;
        }
        for(int m=1;m<=N;++m){
            cout<<d[i][m]<<' ';
        }
        cout<<endl;
    }
}
#include<iostream>
using namespace std;
int main(){
    int N;
    int u[101],k[101],a[101],d[101][101];
    memset(d,0,sizeof(d));
    cin>>N;
    for(int i=0;i<N;++i){
        cin>>u[i]>>k[i];
        for(int j=0;j<k[i];++j){
            cin>>a[j];
            d[u[i]][a[j]]=1;
        }
        for(int m=1;m<=N;++m){
            cout<<d[i][m]<<' ';
        }
        cout<<endl;
    }
}

C++: #include <cstdio>
using namespace std;
int G[107][107];
int main() {
    int n;
    scanf("%d", &n);
    for (int i = 0; i < n; i++) {
    	int id, cnt;
    	scanf("%d%d", &id, &cnt);
    	for (int j = 0; j < cnt; j++) {
    		int tmp;
    		scanf("%d", &tmp);
    		G[id][tmp] = 1;
		}
	}
	for (int i = 1; i <= n; i++) {
		printf("%d", G[i][1]);
		for (int j = 2; j <= n; j++) {
			printf(" %d", G[i][j]);
		}
		putchar('\n');
	}
    return 0;
}

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

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


	return 0;
}