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<bits/stdc++.h>

using namespace std;

int main()
{
    int n, d, u, v, i, j, x;

    cin >> n;

    bool adjmat[n + 1][n + 1];

    for(i = 0; i <= n; i++)
    {
        for(j = 0; j <= n; j++)
            adjmat[i][j] = false;
    }

    for(i = 0; i < n; i++)
    {
        cin >> x >> d;
        for(j = 0; j < d; j++)
        {
            cin >> u;
            adjmat[x][u] = true;
        }
    }

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

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

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP0(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REP1(i,n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
#define RREP0(i,n) for(int i=n-1; i>=0; --i)
#define RREP1(i,n) for(int i=n; i>=1; --i)

#define SORT(c) sort((c).begin(),(c).end())
#define whole(f,x,...) ([&](decltype((x)) whole) { return (f)(begin(whole), end(whole), ## __VA_ARGS__); })(x)
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define CLR(a) memset((a), 0 ,sizeof(a))

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

typedef long long LL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;

const int INTINF = 2147483647;
const LL LLINF = 9223372036854775807;
const double EPS = 1e-10;
const double PI  = acos(-1.0);

int gcd(int a,int b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

int main(int argc, char const *argv[]) {
  int n,v,d; std::cin >> n;
  REP0(i,n){
    std::cin >> v >> d;
    VI row(n,0);
    REP0(j,d){
      std::cin >> v;
      row[v-1]=1;
    }
    REP0(j,n){
      std::cout << row[j];
      if (j<n-1) std::cout << " ";
    }
    std::cout << '\n';
  }

  return 0;
}

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

using namespace std;

#define MAX 110
int matrix[MAX][MAX];
int dst[MAX];

void input(int num){
    for(int i=0;i<MAX;i++){
        dst[i] = -1;
        for(int j=0;j<MAX;j++){
            matrix[i][j] = 0;
        }
    }
    for(int i=1;i<=num;i++){
        int v; cin >> v;
        int tmp; cin >>tmp;
        for(int j=0;j<tmp;j++){
            int vi; cin >> vi;
            matrix[v-1][vi-1] = 1;
        }
    }
}

void bfs(){

}

int main(){
    int num; cin >> num;
    input(num);

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

}