Go: package main

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

var sc = bufio.NewScanner(os.Stdin)

func scanInt() int {
	num, _ := strconv.Atoi(scanString())
	return num
}

func scanString() string {
	sc.Scan()
	return sc.Text()
}

func init() {
	sc.Split(bufio.ScanWords)
}

func main() {
	n := scanInt()
	arr := make([][]int, n)
	for i := 0; i < n; i++ {
		u := scanInt()
		k := scanInt()
		arr[u-1] = make([]int, n)
		for j := 0; j < k; j++ {
			n := scanInt()
			arr[u-1][n-1] = 1
		}
	}

	w := bufio.NewWriter(os.Stdout)
	for _, col := range arr {
		fmt.Fprintln(w, strings.Trim(fmt.Sprint(col), "[]"))
	}
	w.Flush()
}

C++: #include<iostream>
#include<vector>
using namespace std;
int main() {
	int point_number;
	cin >> point_number;
	vector<vector<int>>v(point_number);
	for (int i = 0;i < point_number;i++) {
		int point;
		cin >> point;
		v[i].push_back(point);
		int rinsetu;
		cin >> rinsetu;
		v[i].push_back(rinsetu);
		for (int j = 0;j < rinsetu;j++) {
			int tunagari;
			cin >> tunagari;
			v[i].push_back(tunagari);
	


		}

	
	
	
}
	vector<vector<int>>ans(point_number,vector<int>(point_number));
	for(int i = 0;i < point_number;i++){
		for (int j = 0;j < v[i][1];j++) {
			ans[v[i][0]-1][v[i][j + 2]-1] = 1;
		}


	}
	for (int i=0;i < point_number;i++) {
		for (int j=0;j < point_number;j++) {
			if (j == 0) {
				cout << ans[i][j];
			}
			else {
				cout << " " << ans[i][j];
			}
		}
		cout << endl;
	}
	
}

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

int main()
{
	int n;
	cin >> n;
	vector<vector<int>> g( 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--;
			g[u][v] = 1;
		}
	}

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

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

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

    vector< vector<int> > G(n+5, vector<int>(n+5, 0));

    for(int i=0; i<n; ++i){
        int u, k; cin >> u >> k;
        for(int j=0; j<k; ++j){
            int v; 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;
    }
}

C++: #include <iostream>
#include <algorithm>
using namespace std;
static const int MAX = 101;
int M[MAX][MAX];

int main()
{
    int n, m, s, v;
    cin >> n;
    for (int i = 0; i <= MAX; ++i)
    {
        for (int j = 0; j <= MAX; ++j)
        {
            M[i][j] = 0;
        }
    }
    for (int i = 0; i != n; ++i)
    {
        cin >> m >> s;
        while (s--)
        {
            cin >> v;
            M[m][v] = 1;
        }
    }
    for (int i = 1; i <= n; ++i)
    {
        for (int j = 1; j <= n; ++j)
        {
            cout << M[i][j];
            if (j != n)
            {
                cout << " ";
            }
        }
        cout << endl;
    }
    return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
int main(){
  int n; cin>> n;
  vector<vector<int> > v;
  v = vector<vector<int> >(n, vector<int>(n,0));
  for(int i=0; i<n; ++i){
    int tmp;
    cin >> tmp;
    cin >> tmp;
    for ( int j=0; j<tmp; ++j){
      int to;
      cin >> to;
      v[i][to-1] = 1;
    }
  }
  for(int i=0; i<n; ++i){
    for(int j=0; j<n; ++j){
      cout << v[i][j];
      if( j != n-1) cout << ' ';
    }
    cout << endl;
  }
  return 0;
}

C++: #include<iostream>
#define SIZE 100

using namespace std;

int main(void) {

	int n, c, v;
	int G[SIZE][SIZE];
	int A[SIZE][SIZE];

	cin >> 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 >> v;
		cin >> c;
		for (int j = 0; j < c; j++) {
			cin >> G[i][j];
			int tmp = G[i][j];
			if (tmp > 0) {
				A[i][tmp - 1] = 1;
			}
		}
	}

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

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

static const int N = 100;

int main() {

    int n;
    cin >> n;

    int M[N][N] = {0};
    int u, k, v;
    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 <stack>
#include <vector>

using namespace std;

int main(){
    int n;
    cin >> n;
    int G[n][n];
    for (int i =0; i<n; i++) {
        for (int j =0; j<n; j++) {
            G[i][j] = 0;
        }
    }
    for (int i=0;i<n;i++) {
        int p,m;
        cin >>p >> m;
        for (int j=0; j<m; j++) {
            int q;
            cin >> q;
            G[p-1][q-1]=1;
        }
    }
    for (int i =0; i<n; i++) {
        for (int j =0; j<n; j++) {
            cout << G[i][j]<<" ";
        }
        cout << endl;
    }

}

C++: #include<iostream>
using namespace std;
int v[101][101] = { 0 };
int main() {
	int n; cin >> n;
	int u, k;
	for (int i = 1; i <= n;i++) {
		cin >> u >> k;
		for (int j = 0; j < k;j++) {
			int t; cin >> t;
			v[u][t] = 1;
		}
	}
	for (int i = 1; i <= n;i++) {
		for (int j = 1; j <= n;j++) {
			cout << v[i][j] << " ";
		}
		cout << endl;
	}
}

C++: #include<iostream>
#define rep(i,n) for(int i=0; i<n; i++)

using namespace std;

int main(void)
{
    int n, u, v, k, a[101][101]={0}, adj[101];

    cin >> n;
    rep(i,n){
        cin >> u >> k;
        rep(i,k){
            cin >> v;
            a[u][v] = 1;
        }
    }

    rep(i,n){
        rep(j,n){ cout << a[i+1][j+1]; if(j != n-1) cout << ' ';}
        cout << endl;
    }
    return 0;
}

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

int main(){
    int n,u,k;
    int *U;
    cin>>n;
    
    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>>k;
        U= new int[k];
        for(int j=0;j<k;j++){
            cin>>U[j];
            A[i][U[j]-1]=1;
            
        }
    
    } 
    for(int i=0;i<n;i++){
        cout<<A[i][0];
        for(int j=1;j<n;j++){
           cout<<" "<<A[i][j];
        }
        cout<<endl;
    }


}

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

#include <algorithm>
#include <numeric>
#include <cmath>

using namespace std;
typedef long long ll;
const long double PI = (acos(-1));
const long long MOD = 1000000007;
#define rep(i,n) REP(i,0,n)
#define REP(i,x,n) for(int i=x;i<n;++i)

///////////////////////////////////////////////////
// ------------------- utils ------------------- //
///////////////////////////////////////////////////
// change min/max
template<class T> inline bool chMin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chMax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

///////////////////////////////////////////////////
// ------------------- main -------------------- //
///////////////////////////////////////////////////
void Main() {
	int n; cin >> n;
	vector<vector<int> > g(n, vector<int>(n,0));
	rep(i, n) {
		int u, k; cin >> u >> k;
		rep(j, k) {
			int to; cin >> to;
			g[u-1][to-1]=1;
		}
	}

	rep(i, n) {
		rep(j, n) {
			if (j != (n-1)) {
				cout << g[i][j] << " ";
			}
			else {
				cout << g[i][j];
			}
		}
		cout << endl;
	}
}

int main() {
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	std::cout << std::fixed << std::setprecision(15);
	Main();

	return 0;
}