Go: package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scan(&n)
	g := make([][]int, n)
	for i := 0; i < n; i++ {
		g[i] = make([]int, n)
	}

	for i := 0; i < n; i++ {
		var u,k int
		fmt.Scan(&u)
		fmt.Scan(&k)
		for j := 0; j < k; j++ {
			var v int
			fmt.Scan(&v)
			g[u-1][v-1] = 1
		}
	}

	for i := 0; i < n; i++ {
		fmt.Print(g[i][0])
		for j := 1; j < n; j++ {
			fmt.Printf(" %d", g[i][j])
		}
		fmt.Println()
	}
}

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

C++: #include <iostream>
#include <algorithm>
#include <vector>
#include <deque>
#include <queue>
#include <list>
#include <stack>
#include <string>
#include <tuple>
#include <functional>
#include <numeric>
#include <cmath>
#include <iomanip>
#include <map>
#include <random>
#include <cstdlib>
#define INT_MAX 2147483647
#define INT_MIN -2147483646
#define Loop(i, n) for(int i = 0; i < (int)n; i++)
#define Loop1(i, n) for(int i = 1; i <= (int)n; i++)
#define Loopr(i, n) for(int i = (int)n - 1; i >= 0; i--)
#define Loopr1(i, n) for(int i = (int)n; i >= 1; i--)
using namespace std;
typedef long long int ll;

bool mx[105][105];

int main() {
	int n;
	cin >> n;
	Loop1(i, n) {
		Loop1(j, n) {
			mx[i][j] = 0;
		}
	}
	Loop(i, n) {
		int u, k;
		cin >> u >> k;
		Loop(j, k) {
			int v;
			cin >> v;
			mx[u][v] = 1;
		}
	}
	Loop1(i, n) {
		Loop1(j, n - 1) {
			cout << mx[i][j] << " ";
		}
		cout << mx[i][n] << endl;
	}
	return 0;
}