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++: int main(){ //??°???????????£??\??????????????£??\?????????????????????????????°??????
    
    int n,k,v,w;
    
    cin >> n; //??°????????????????????\???
    
    Matrix M(n,Array(n,0)); //??£??\??????????????????
    
    for (int i=0; i<n; i++) { //??????????¬???°?????????????????\??? ???????????\??????????????£??\??????????????£??\?????????????´?
        cin >> w >> k;
        for (int j=0; j<k; j++) {
            cin >> v;
            M[w-1][v-1] = 1; //?????????
        }
    }
    
    for (int i=0; i<n; i++) { //????????¢?????§??????
        for (int j=0; j<n; j++) {
            cout << M[i][j];
            if (j!=n-1) {
                cout << " ";
            }
        }
        cout << endl;
    }
    
    return 0;
}

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

int G[101][101];

int main(){
  int n, u, k, v;
  cin >> n;
  for(int i = 0; i < n; i++){
    cin >> u >> k;
    for(int j = 0; j < k; j++){
      cin >> v;
      G[u][v] = 1;
    }
  }
  for(int i = 1; i <= n; i++)
    for(int j = 1; j <= n; j++)
      cout << G[i][j] << (j == n ? '\n' : ' ');
  return 0;
}

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

int n, u, k, v, a[101][101] = { 0 };

int main(){
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> u >> k;
		for (int j = 0; j < k; j++) {
			cin >> v;
			a[u][v] = 1;
		}
	}
	for (int i = 1; i <= n; i++) {
		cout << a[i][1];
		for (int j = 2; j <= n; j++) {
			cout << " " << a[i][j];
		}
		cout << endl;
	}

	return 0;
}

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

int main()
{
    int input_size;
    scanf("%d", &input_size);
    std::vector<std::vector<bool> > neighbor_exists(input_size, std::vector<bool>(input_size, false));
    for(int i = 0; i < neighbor_exists.size(); i++) {
        int id, num_neighbors;
        scanf("%d %d", &id, &num_neighbors);
        for(int j = 0; j < num_neighbors; j++) {
            int neighbor_id;
            scanf("%d", &neighbor_id);
            neighbor_exists[id-1][neighbor_id-1] = true;
        }
    }

    for(int i = 0; i < neighbor_exists.size(); i++) {
        if(neighbor_exists[i][0]) {
            putchar('1');
        } else {
            putchar('0');
        }
        for(int j = 1; j < neighbor_exists[i].size(); j++) {
            putchar(' ');
            if(neighbor_exists[i][j]) {
                putchar('1');
            } else {
                putchar('0');
            }
        }
        putchar('\n');
    }
    return 0;
}

C++: #include <algorithm>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;

#define MOD 1000000007

int main() {
  int n;
  cin >> n;
  vector<vector<int> > mat(n, vector<int>(n));
  for (int i = 0; i < n; ++i) {
    int u, k;
    cin >> u >> k;
    u--;
    for (int j = 0; j < k; ++j) {
      int v;
      cin >> v;
      v--;
      mat[u][v] = 1;
    }
  }
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < n; ++j) {
      cout << mat[i][j] << (j == n - 1 ? "" : " ");
    }
    cout << "\n";
  }
  return 0;
}

C++: #include <stdio.h>

#define N 100

int main(){

  int u,v,n,k,i,j,A[N][N];

  scanf("%d",&n);

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

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

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

  return 0;
}

C++: #include <iostream>
using namespace std;
int adj[100][100] = {0};
int main()
{
	int n;
	cin >> n;
	for (int i=0;i<n;i++) {
		int j, k;
		cin >> j >> k;
		j--;
		for (int m=0;m<k;m++) {
			int a;
			cin >> a;
			a--;
			adj[j][a]=1;
		}
	}

	for (int i=0;i<n;i++) {
		for (int j=0;j<n;j++) {
			if (j) cout << ' ';
			cout << adj[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==n-1){
                cout<<M[i][j];
            }
            else{
                cout<<M[i][j];
                cout<<" ";
            }
        }
        cout<<endl;
    }
    return 0;
}

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

using namespace std;

void print(vector<vector<int> > a){
    for(int i = 1; i < a.size(); i++){
        for(int j = 1; j < a[0].size(); j++){
            cout << a[i][j];
            if(j + 1 < a[0].size())cout << " ";
        }
        cout << endl;
    }
}

int main(void){
    int n;
    cin >> n;
    vector<vector<int> > a(n+1, vector<int>(n+1));
    for(int i = 1; i <= n; i++){
        int k, l;
        cin >> k >> l;
        for(int j = 1; j <= l; j++){
            int temp;
            cin >> temp;
            a[i][temp] = 1;
        }
    }
    print(a);
    return 0;
}

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

int v[100][100];

signed main()
{
  int n;
  int u, k;

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

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

  return (0);
}

C++: #include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
#include<string>
using namespace std;
int main()
{
  int n;
  cin>>n;
  int u,k,v;
  int dp[n][n];
  for(int i=0;i<n;i++)
  {
    for(int j=0;j<n;j++) dp[i][j]=0;
  }

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

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