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>
#define NUM 100
using namespace std;

int p[NUM];
int result[NUM][NUM];

int main()
{
    int n;
    cin >> n;
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < n; j++)
        {
            result[i][j] = 0;
        }
    }

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

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

    return 0;
}

C++: #include <stdio.h>
int A[100][100];
int main(void){
  int k,j,n,u,v,uv,V;
  scanf("%d",&V);
  for(n=0;n<V;n++){
    scanf("%d%d",&u,&k);
    for(j=0;j<k;j++){
      scanf("%d",&v);
      A[u-1][v-1]=1;
    }
  }
  for(v=0;v<V;v++){
    
    for(uv=0;uv<V;uv++){
      if(uv!=0){
	printf(" ");
      }
      printf("%d",A[v][uv]);
    }
    printf("\n");
  }
  
  return 0;
}

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

int A[101][101];

int main() {
	int n;
	cin >> n;
	for (int t = 0; t < n; t++) {
		int i, k;
		cin >> i >> k;
		for (int s = 0; s < k; s++) {
			int j;
			cin >> j;
			A[i][j] = 1;
		}
	}
	for (int i = 1; i < n + 1; i++) {
		for (int j = 1; j < n + 1; j++) {
			if (j != 1)cout << ' ';
			cout << A[i][j];
		}
		cout << endl;
	}
	return 0;
}

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

using namespace std;


struct node {
    int id;
    node *next;
};


node hdrs[101];
int adj[101][101];


int main()
{
    int n;
    cin >> n;
    for (int i = 1; i <= n; i++) {
        hdrs[i].next = &hdrs[i];
        hdrs[i].id = i;
    }

    for (int i = 1; i <= n; i++) {
        int k;
        int id;
        cin >> id >> k;
        for (int j = 0; j < k; j++) {
            int v;
            cin >> v;

            node *t = (node *)malloc(sizeof(node));
            t->id = v;
            t->next = hdrs[id].next;
            hdrs[id].next = t;
        }
    }

    for (int i = 1; i <= n; i++) {
        node *t = &hdrs[i];
        while (t->next != &hdrs[i]) {
            t = t->next;
            adj[i][t->id] = 1;
        }
    }

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

    return 0;
}

C++: #define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <list>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <queue>
#include <iomanip>
#define INF 2147483647
 
using namespace std;

int main(void)
{
	int n, k, u, v;
	int G[101][101];

	cin >> n;

	memset(G, 0, sizeof(G));

	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] << " ";  
		}
		cout << endl;
	}

	return (0);
}

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

using namespace std;

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

    vector<vector<int>> neighbor(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 x;
            cin >> x;
            neighbor[u - 1][x - 1] = 1;
        }
    }

    for (int i = 0; i < neighbor.size(); i++) {
        for (int j = 0; j < neighbor[i].size(); j++) {
            if (j > 0)
                cout << " ";
            cout << neighbor[i][j];
        }
        cout << endl;
    }

    return 0;
}

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

using namespace std;

int main() {
    //freopen("in.txt", "r", stdin);
    int n;
    cin >> n;
    vector<vector<int> > G(n + 1, vector<int>(n + 1, 0));
    for (int i = 0; i < n; i++) {
        int u, k;
        cin >> u >> k;
        int v;
        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++) {
            if (j < n) cout << G[i][j] << " ";
            else cout << G[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 <stdio.h>

#define MAX 101

int main() {
    int n;
    int M[MAX][MAX];
    scanf("%d", &n);
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= n; j++) {
            M[i][j] = 0;
        }
    }
    
    for (int i = 1; i <= n; i++) {
        int id, k;
        scanf("%d %d", &id, &k);
        if (k == 0) continue;
        else {
            for (int j = 1; j <= k; j++) {
                int v; scanf("%d", &v);
                M[id][v] = 1;
            }
        }
    }
    
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= n; j++) {
            if (j == n) printf("%d\n", M[i][j]);
            else printf("%d ", M[i][j]);
        }
    }
    
    return 0;
}

C++: #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repr(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define FORR(i, m, n) for (int i = (m); i >= (n); --i)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
const ll mod2 = 998244353;
const int INF = 1000000005;


int main() {
  int n, u, k, v;
  cin >> n;
  bool G[n][n];
  rep(i, n) {
    rep(j, n) {
      G[i][j] = false;
    }
  }
  rep(i, n) {
    cin >> u >> k;
    rep(i, k) {
      cin >> v;
      G[u-1][v-1] = true;
    }
  }

  rep(i, n) {
    rep(j, n) {
      if (j) cout << " ";
      cout << G[i][j];
    }
    cout << endl;
  }


  
  return 0;
}

C++: 
#include <iostream>
using namespace std;
int main() {
    int n,p,q,x;
    cin>>n;
    int A[100][100]={};
    for (int i=0;i<n;i++){
        cin>>q>>p;
        if (p==0)
            continue;
        for (int j=0;j<p;j++){
            cin>>x;
            A[q][x-1]=1;
        }
    }
    for (int i=0;i<n;i++){
        for (int j=0;j<n;j++){
            cout<<A[i][j];
            if (j!=n-1)cout<<" "; 
        }
        cout<<endl;
    }
    return 0;
}