Go: package main

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

func main() {
	scn := bufio.NewScanner(os.Stdin)
	scn.Split(bufio.ScanWords)
	nextInt := func() int { scn.Scan(); r, _ := strconv.Atoi(scn.Text()); return r }
	w := bufio.NewWriter(os.Stdout)

	n := nextInt()
	v := make([][]int, n)
	for i := 0; i < n; i++ {
		u := nextInt()
		k := nextInt()
		for j := 0; j < k; j++ {
			v[u-1] = append(v[u-1], nextInt())
		}
	}

	for _, vvs := range v {
		for j := 1; j <= n; j++ {
			if j > 1 {
				fmt.Fprint(w, " ")
			}
			p := sort.SearchInts(vvs, j)
			if p < len(vvs) && vvs[p] == j {
				fmt.Fprint(w, 1)
			} else {
				fmt.Fprint(w, 0)
			}
		}
		fmt.Fprintln(w)
	}

	w.Flush()
}

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

C++: #include <iostream>

using namespace std;

int main(){
  int n, u, k, v;
  bool G[100][100] = {0};

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

  for(int i = 0;i < n;i++){
    for(int j = 0;j < n;j++){
      cout << G[i][j];
      if(j != n-1) cout << ' ';
    }

    cout << endl;
  }

  return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    int graph[110][110]={0};
    cin>>n;
    for(int i=1;i<=n;++i)
    {
        int v,k,tm;
        cin>>v>>k;
        while(k--)
        {
            cin>>tm;
            graph[v][tm]=1;
        }
    }
    for(int i=1;i<=n;++i)
    {
    for(int j=1;j<=n;++j)
    {
        if(j>1){cout<<" ";}
        cout<<graph[i][j];
    }
    cout<<endl;
    }
    return 0;
}