Go: package main

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

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)
	scanner.Scan()
	n, _ := strconv.Atoi(scanner.Text())
	Adj := make([][]int, n)
	for i := range Adj {
		Adj[i] = make([]int, n)
	}
	for i := 0; i < n; i++ {
		scanner.Scan()
		u, _ := strconv.Atoi(scanner.Text())
		scanner.Scan()
		k, _ := strconv.Atoi(scanner.Text())
		if k == 0 {
			continue
		}
		for i := 0; i < k; i++ {
			scanner.Scan()
			v, _ := strconv.Atoi(scanner.Text())
			Adj[u-1][v-1] = 1
		}
	}
	for i := range Adj {
		for j := range Adj[i] {
			if j == n-1 {
				fmt.Printf("%d\n", Adj[i][j])
				continue
			}
			fmt.Printf("%d ", Adj[i][j])
		}
	}
}

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

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

C++: #include <stdio.h>

int map_max;
int map[101][101];
int rows;
int cols[101];
int mat[101][101];

void get_map();
void print_map();
void conv_map();
void print_mat();

int main()
{

  get_map();
  //print_map();
  conv_map();
  print_mat();
  return 0;
}

void get_map()
{

  int k;
  scanf("%d", &map_max);//<100

  for(int i=0;i<map_max;i++)
    {
      scanf("%d", &k);
      scanf("%d", &cols[i]);
      for(int j=0;j<cols[i];j++)
	{
	  map[i-1][j-1]=0;
	  scanf("%d", &map[i-1][j-1]);
	}
    }

  
  return ;
}

void print_map()
{
  for(int i=0;i<map_max;i++)
    {
      for(int j=0;j<cols[i];j++)
	{
	  printf("%d", map[i-1][j-1]);
	}
      puts("");
    }
return ;
}


void conv_map()
{
  for(int i=0;i<map_max;i++)
    {
      for(int j=0;j<cols[i];j++)
	{
	  mat[i][map[i-1][j-1]-1]=1;
	}
    }
  return ;
}

void print_mat()
{
  for(int i=0;i<map_max;i++)
    {
      for(int j=0;j<map_max;j++)
	{
	  printf("%d ", mat[i][j]);
	}
      puts("");
    }
}

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

int main(){
	int graph[100][100] = {};
	int n;
	cin >> n;
	for(int i = 0;i < n;i++){
		int now,m;
		cin >> now >> m;
		for(int j = 0;j < m;j++) {
			int t;
			cin >> t;
			graph[now - 1][t - 1] = 1;
		}
	}
	for(int i = 0;i < n;i++){
		cout << graph[i][0];
		for(int j = 1;j < n;j++){
			cout << " " << graph[i][j];
		}
		cout << endl;
	}
	return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <string>
#include <stack>
#include <cstdlib>
#include <queue>
#include <vector>
#include <set>
bool a[100][100];
using namespace std;
int main() {
	int n,m,l,p;
	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 >> m;
		cin >> l;
		for(int j = 0; j < l;j++) {
			cin >> p;
			a[m-1][p-1] = 1;
		}
	}
	for ( int i = 0;i < n;i++) {
		for(int j= 0; j < n-1;j++) {
			cout << a[i][j] << " ";
		}
		cout << a[i][n-1] << endl;
	}
}

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

using namespace std;

#define FOR(i, a, b) for(ll i = (a); i < (b); ++i)
#define FORR(i, a, b) for(ll i = (a); i > (b); --i)
#define REP(i, n) for(ll i = 0; i < (n); ++i)
#define REPR(i, n) for(ll i = n; i >= 0; i--)
#define FOREACH(x, a) for(auto &(x) : (a))
#define VECCIN(x)                                                              \
    for(auto &youso_ : (x)) cin >> youso_
#define mp make_pair
#define bitcnt __builtin_popcount
#define SZ(x) ((ll)(x).size())
#define All(a) (a).begin(), (a).end()
template <typename T = long long> inline T IN() {
    T x;
    cin >> x;
    return (x);
}
inline void CIN() {}
template <class Head, class... Tail>
inline void CIN(Head &&head, Tail &&... tail) {
    cin >> head;
    CIN(move(tail)...);
}
#define CINT(...)                                                              \
    int __VA_ARGS__;                                                           \
    CIN(__VA_ARGS__)
#define LCIN(...)                                                              \
    ll __VA_ARGS__;                                                            \
    CIN(__VA_ARGS__)
#define SCIN(...)                                                              \
    string __VA_ARGS__;                                                        \
    CIN(__VA_ARGS__)
#define Yes(a) cout << (a ? "Yes" : "No") << "\n"
#define YES(a) cout << (a ? "YES" : "NO") << "\n"

typedef long long ll;
typedef unsigned long long ul;
typedef vector<int> V;
typedef vector<ll> VL;
typedef pair<ll, ll> PL;
typedef priority_queue<ll> PQ;
typedef priority_queue<ll, V, greater<ll>> PQG;

const int INF = 1e9;
const int MOD = 1e9 + 7;
// const int MOD = 998244353;
const ll LINF = 1e18;

ll N, M;
vector<VL> G;
vector<bool> went;
ll ans = 0;

void dfs(ll now, ll cnt) {
    if(cnt == N) {
        ans++;
        cout << now << "\n";
    }
    FOREACH(to, G[now]) {
        if(!went[to]) {
            went[to] = true;
            dfs(to, cnt + 1);
            went[to] = false;
        }
    }
}
signed main() {
    cin >> N;
    G.assign(N, VL(N, 0));
    REP(i, N) {
        LCIN(u, k);
        u--;
        REP(j, k) { G[u][IN() - 1] = 1; }
    }
    REP(i, N) {
        REP(j, N) {
            if(j == N - 1) cout << G[i][j] << "\n";
            else cout << G[i][j] << " ";
        }
    }
    return 0;
}

C++: #include<iostream>

using namespace std;

#define ll long long

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

    for (ll i=0; i<n; i++){
        for(ll j=0; j<n; j++){
            cout << A[i][j];
        }
        cout << '\n';
    }
}

C++: #include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>

using namespace std;

static const int N = 100;
int M[N][N];


int main(){
	int n; 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)
	{
		int u, d; cin >> u >> d;
		for (int j = 0; j < d; ++j) {
			int v;  cin >> v;
			M[u - 1][v - 1] = 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[100],k[100]={},v[100][100];
  cin >> n;
  for(int i=0; i<n; i++){
    cin >> u[i] >> k[i];

    for(int j=0; j<k[i]; j++)
      cin >> v[i][j];
  }

  for(int i=0; i<n; i++){
    int count=0;
    for(int j=0; j<n; j++){
      if(v[i][count]==j+1){
        cout << 1;
        count++;
      }

      else
        cout << 0;

      if(j!=n)
        cout << " ";
      }

      cout << endl;
    }
  }

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

using namespace std;

int N;

int main()
{
	cin >> N;

	vector<vector<bool> > M(N, vector<bool>(N));

	int u, k, v;

	for (int i = 0; i < N; i++)
	{
		cin >> u >> k;

		for (int i = 0; i < k; i++)
		{
			cin >> v;

			M[u - 1][v - 1] = true;
		}
	}

	for (int i = 0; i < N; i++)
	{
		for (int j = 0; j < N; j++)
		{
			cout << M[i][j];

			if (j != N - 1)
			{
				cout << ' ';
			}
		}

		cout << endl;
	}

	return 0;
}