Go: package main

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

const N = 100

func answer(reader io.Reader) string {
	sc := bufio.NewScanner(reader)
	sc.Split(bufio.ScanWords)

	sc.Scan()
	n, _ := strconv.Atoi(sc.Text())

	var M [N][N]int
	for i := 0; i < n; i++ {
		sc.Scan()
		u, _ := strconv.Atoi(sc.Text())
		sc.Scan()
		k, _ := strconv.Atoi(sc.Text())
		u--
		for j := 0; j < k; j++ {
			sc.Scan()
			v, _ := strconv.Atoi(sc.Text())
			v--
			M[u][v] = 1
		}
	}

	var out bytes.Buffer
	for i := 0; i < n; i++ {
		for j := 0; j < n; j++ {
			if j != 0 {
				out.WriteString(" ")
			}
			out.WriteString(fmt.Sprintf("%d", M[i][j]))
		}
		out.WriteString("\n")
	}

	return strings.TrimRight(out.String(), "\n")
}

func main() {
	fmt.Println(answer(os.Stdin))
}

C++: #include <iostream>
using namespace std;
int main() {
    int num, num1, numb2, list1;
    cin >> num;
    int matrix[num][num] = {};
    for(int i = 0; i < num; i++) {
        cin >> num1 >> numb2;
        for(int i = 0 ; i < numb2; i++) {
            cin >> list1;
            matrix[num1 - 1][list1 - 1] = 1;
        }
    }
    for(int i = 0 ; i < num; i++) {
        for (int p = 0; p < num; p++) {
            if (p != num -1) {
                cout << matrix[i][p] << " ";
            } else cout<<matrix[i][p] << endl;
        }
    }
}

C++: #include "bits/stdc++.h"

#define REP(i,num) for(int i=0;i<(num);++i)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto& x:c){cout<<x<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

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

	int N=in();
	vector<vector<int>> M(N,vector<int>(N,0));
	REP(i,N){
		int v=in()-1,k=in();
		REP(j,k){
			M[v][in()-1] = 1;
		}
	}

	REP(i,N){
		REP(j,N-1){
			cout << M[i][j] << ' ';
		}
		out(M[i][N-1]);
	}
	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 A[101][101] = {0};

int main(){
    int n, numx, numy, count;
    cin >> n;
    
    for(int i=1;i<=n;++i){
        cin >> numx;
        cin >> count;
        for(int j=0;j<count;++j){
            cin >> numy;
            A[numx][numy] = 1;
        }
    }
    
    for(int i=1;i<=n;i++){
        for(int j=1;j<=n;j++){
            cout << A[i][j];
            if(j!=n){
                cout <<" ";
            }
        }
        cout << endl;
    }
    
    return 0;
}

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

int main(){
  int n,u,k,v;
  int g[102][102];
  
  memset(g,0,sizeof(g));

  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++){
      if(j!=1)cout<<" ";
      cout<<g[i][j];
    }
    cout<<endl;
  }
  return(0);
}

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

bool find(vector<int> v, int j){
    bool e = false;
    for(vector<int>::iterator it = v.begin(); it!=v.end(); ++it){
        if (*it == j) e = true;
    }
    return e;
}

int main(){
    vector<int> adj[MAXN];
    int n; cin >> n;
    for(int i=1; i<=n; ++i){
        int l, m; cin >> l >> m;
        for(int j=0; j<m; ++j){
            int k; cin >> k;
            adj[l].push_back(k);
        }
    }
    
    for(int i=1; i<=n; ++i){
        for(int j=1; j<n; ++j){
            cout << (find(adj[i], j) ? 1 : 0 ) << " ";
        }
        cout << (find(adj[i], n) ? 1:0) << endl;
    }
}

C++: #include <iostream>
using namespace std;
int v[101][101];
int main(void){
    int n;
    cin >> n;
    int x,y,z;
    for(int i=1;i<=n;i++){
        cin >> x>>y;
        for(int j=1;j<=y;j++){
            cin >> z;
            v[i][z]=1;
        }
    }
    for(int i=1;i<=n;i++){
        for(int j=1;j<=n;j++){
            if(j!=n){
                cout << v[i][j]<<" ";
            }
            else{
                cout << v[i][j];
            }
        } 
        cout << endl;
    }
}

C++: int main(){
  int n;
  cin>>n;

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

C++: #include <cstdio>
#include <iostream>
#include <algorithm>
#define rep(i,n) for(int i=0; i<(n); ++i)
#define outl(x) cout<< (x) << '\n'
using namespace std;

bool G[105][105];

signed main()
{
   cin.tie(0), ios::sync_with_stdio(false);
   int N;
   cin >> N;

   rep(i, N){
      int k, u, p;
      cin >> u >> k;
      --u;

      rep(j, k){
         cin >> p;
         --p;
         G[u][p] = true;
      }
   }

   rep(i, N){
      rep(j, N){
         cout << G[i][j] << ((j+1 < N)? ' ' : '\n') ;
      }
   }

}

C++: #include<iostream>
#include<algorithm>
#define N 105
using namespace std;

int n;
int M[N][N];
int main()
{
	cin >> n;
	int u, v;
	for (int i = 0; i < n; i++)
	{
		int s;
		cin >> u >> s;
		for (int j = 0; j < s; j++)
		{
			cin >> v;
			M[u][v] = 1;
		}
	}
	for (int i = 1; i <= n; i++)
	{
		for (int j = 1; j <= n; j++)
		{
			if (j > 1)
				cout << ' ';
			cout << M[i][j];
		}
		cout << endl;
	}
	return 0;
}

C++: #include<cstdio>
#include<algorithm>
#include<iostream>
using namespace std;
#define MAX 100

int ADJ[MAX+1][MAX+1];

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

    for(i = 1; i <= n; i++){
        for(j = 1; j <= n; j++){
            cout << ADJ[i][j];
            if(j != n) cout << " ";
        }

        cout << endl;
    }

    return 0;
}

C++: #include <stdio.h>
#include <stdlib.h>
#pragma warning(disable:4996)
int main(){
	int n;
	int a, b;
	int A[101];
	int **arr = NULL;
	scanf("%d", &n);	
	arr = new int*[n];
	for (int i = 0; i < n; i++){
		arr[i] = new int[n];
	}
	for (int i = 0; i < n; i++){		
		scanf("%d%d", &a, &b);
		for (int j = 0; j < b; j++){
			scanf("%d",&A[j]);
			arr[i][A[j]-1] = 1;
		}
	}
	for (int i = 0; i < n; i++){
		for (int j = 0; j < n; j++){
			if (arr[i][j] == 1){
				printf("1 ");
			}
			else {
				printf("0 ");
			}
		}
		printf("\n");
	}
	for (int i = 0; i < n; i++){
		delete[](arr[i]);
	}
	delete[](arr);
	return 0;
}