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

C++: #include<iostream>
#include<cstdio>
#include<cstring>
#include<cctype>
#include<string>
#include<algorithm>
#include<vector>
#include<climits>
#include<stack>
#include<queue>
#include <utility> 
using namespace std;

long long mod = 1000000007;



int main()
{
	int N,M[100][100];
	cin >> N;

	for (int i = 0; i < 100; i++) {
		for (int j = 0; j < 100; j++) {
			M[i][j] = 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 == 0)
				cout << M[i][j];
			else
				cout << " " << M[i][j];
		}
		cout << endl;
	}


	


	return 0;
}

C++: #include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
const int MAX=105;
int M[MAX][MAX];
int main(){
	int n,u,k;
	cin>>n;
	memset(M,0,sizeof(M));
	for(int i=0;i<n;i++){
		cin>>u>>k;
		int v;
		for(int j=0;j<k;j++){
			cin>>v;
			M[u][v]=1;
		}
	}		
	for(int i=1;i<=n;i++){
		int first=1;
			for(int j=1;j<=n;j++){
				if(first)first=0;else putchar(' ');
				cout<<M[i][j];
			}
			cout<<endl;
		}
	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll mod = 1e9 + 7;
const ll inf = (1 << 30) - 1;
const ll infll = (1LL << 61) - 1;

template <typename T>
struct edge
{
    int src, to;
    T cost;

    edge(int to, T cost) : src(-1), to(to), cost(cost) {}

    edge(int src, int to, T cost) : src(src), to(to), cost(cost) {}

    edge &operator=(const int &x)
    {
        to = x;
        return *this;
    }

    operator int() const { return to; }
};

//Weighted edge set
template <typename T>
using Edges = vector<edge<T>>;
//Weighted graph
template <typename T>
using WeightedGraph = vector<Edges<T>>;
//Unweighted graph (adjacency matrix)
using UnweightedGraph = vector<vector<int>>;
//distance matrix
template <typename T>
using Matrix = vector<vector<T>>;

int main()
{
    int N;
    cin >> N;
    UnweightedGraph G = vector<vector<int>>(N, vector<int>(N, 0));
    for (int i = 0; i < N; i++)
    {
        int a, c;
        cin >> a >> c;
        a--;
        for (int j = 0; j < c; j++)
        {
            int b;
            cin >> b;
            b--;
            G[a][b]++;
        }
    }
    for (int i = 0; i < N; i++)
    {
        for (int j = 0; j < N; j++)
        {
            cout << G[i][j] << (j == N - 1 ? "\n" : " ");
        }
    }
}

C++: #include<stdio.h>

int main(){
  int i,j,n,k,c,b;

  int a[124][124]={{}};

  scanf("%d",&n);
  for(i=0;i<n;i++){

    scanf("%d %d",&c,&b);
    for(j=0;j<b;j++){
      scanf("%d",&k);
      a[c-1][k-1]=1;

    }
  }
  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
    printf("%d ",a[i][j]);
    }
    puts("");
 
}
  return 0;
}

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

void fnInput(vector<vector<int>> &rvvnAdjcy)
{
  int nMaxSiz;
  cin >> nMaxSiz;

  rvvnAdjcy.resize(nMaxSiz + 1, vector<int>(nMaxSiz + 1, 0));
  for (int i = 0; i < nMaxSiz; i++)
  {
    int nx, nSecSiz;
    cin >> nx >> nSecSiz;
    for (int j = 0; j < nSecSiz; j++)
    {
      int ny;
      cin >> ny;
      rvvnAdjcy[nx][ny] = 1;
    }
  }
}

void fnResult(const vector<vector<int>> &cnrvvnAdjcy)
{
  for (int i = 1; i < cnrvvnAdjcy.size(); i++)
  {
    for (int j = 1; j < cnrvvnAdjcy[i].size(); j++)
      cout << cnrvvnAdjcy[i][j] << " ";
    cout << endl;
  }
}

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  vector<vector<int>> vvnAdjcy;

  fnInput(vvnAdjcy);
  fnResult(vvnAdjcy);

  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];
            if(j!=n-1) cout << " ";
        }
        cout << endl;
    }

}

C++: #include<stdio.h>
#define N 100
int main(){
  int a[N][N],v[N];
  int n,i,j,u,k;


  scanf("%d",&n);

  for(i=1;i<=n;i++){
    for(j=1;j<=n;j++){
      a[i][j]=0;
    }
  }
    
  for(i=1;i<=n;i++){
    scanf("%d %d",&u,&k);
    for(j=1;j<=k;j++){
      scanf("%d",&v[j]);
      a[u][v[j]]=1;
    }
  }

  for(i=1;i<=n;i++){
    for(j=1;j<=n;j++){
      printf("%d",a[i][j]);
      printf(" ");
    }
    printf("\n");
  }

  
  return 0;
}

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

using namespace std;

int main() {
	int n,row,size,tmp;
	cin >> n;
	int** mat = new int* [n];
	for (int i = 0;i < n;i++) {
		cin >> row >> size;
		mat[row - 1] = new int[n];
		for (int j = 0;j < n;j++) {
			mat[row - 1][j] = 0;
		}
		for (int j = 0;j < size;j++) {
			cin >> tmp;
			mat[row - 1][tmp - 1] = 1;
		}
	}
	for (int i = 0;i < n;i++) {
		for (int j = 0;j < n-1;j++) {
			cout << mat[i][j] << " ";
		}
		cout << mat[i][n - 1] << endl;
	}
}