Go: package main

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

// I/O
type Scanner struct {
	sc *bufio.Scanner
}

func NewScanner() *Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &Scanner{sc}
}

func (s *Scanner) nextStr() string {
	s.sc.Scan()
	return s.sc.Text()
}

func (s *Scanner) nextInt() int {
	i, e := strconv.Atoi(s.nextStr())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *Scanner) nextFloat() float64 {
	f, e := strconv.ParseFloat(s.nextStr(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

func (s *Scanner) nextRuneSlice() []rune {
	return []rune(s.nextStr())
}

func (s *Scanner) nextIntSlice(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextInt()
	}
	return res
}

func (s *Scanner) nextFloatSlice(n int) []float64 {
	res := make([]float64, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextFloat()
	}
	return res
}

// Arithmetic
func max(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m < i {
			m = i
		}
	}
	return m
}

func min(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m > i {
			m = i
		}
	}
	return m
}

func abs(x int) int {
	if x > 0 {
		return x
	}
	return -x
}

func pow(x, y int) int {
	res := 1
	for i := 0; i < y; i++ {
		res *= x
	}
	return res
}

func ceil(a, b int) int {
	if a%b == 0 {
		return a / b
	} else {
		return a/b + 1
	}
}

// Sort
type RuneSlice []rune

func (a RuneSlice) Len() int           { return len(a) }
func (a RuneSlice) Less(i, j int) bool { return a[i] < a[j] }
func (a RuneSlice) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }

// Main
func main() {
	sc := NewScanner()
	wtr := bufio.NewWriter(os.Stdout)
	N := sc.nextInt()
	g := make([][]int, N)
	for i, _ := range g {
		g[i] = make([]int, N)
	}
	for i := 0; i < N; i++ {
		u, k := sc.nextInt(), sc.nextInt()
		for j := 0; j < k; j++ {
			g[u-1][sc.nextInt()-1] = 1
		}
	}

	for _, r := range g {
		for i, num := range r {
			if i > 0 {
				fmt.Fprint(wtr, " ")
			}
			fmt.Fprint(wtr, num)
		}
		fmt.Fprintln(wtr)
	}
	wtr.Flush()
}

C++: #include<iostream>
#include<string>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <algorithm>
#include <cstdlib>
using namespace std;
int ctoi(char c) {
	switch (c) {
	case '0': return 0;
	case '1': return 1;
	case '2': return 2;
	case '3': return 3;
	case '4': return 4;
	case '5': return 5;
	case '6': return 6;
	case '7': return 7;
	case '8': return 8;
	case '9': return 9;
	default: return 0;
	}
}

int main() {
	vector<vector<int> > M(100,vector<int>(100,0));
	int N, U, K, V;
	cin >> N;
	int i, j;
	for (i = 0; i < N; i++) {
		for (j = 0; j < N; j++) {
			M.at(i).at(j)=0;
		}
	}
	for (i = 0; i < N; i++) {
		cin >> U >> K;
		U--;
		for (j = 0; j < K; j++) {
			cin >> V;
			V--;
			M.at(U).at(V) = 1;
		}
	}
	for (i = 0; i < N; i++) {
		for (j = 0; j < N; j++) {
			if (j) {
				cout << " ";
			}
			cout << M.at(i).at(j);
		}
		cout << endl;
	}
}

C++: #include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<pair<int, int>, int> PP;
const ll INF = 1LL << 60;
const ll MOD = 1000000007;
const int MAX = 1000000000;

int GCD(int a, int b) { return b ? GCD(b, a % b) : a; }
//------------------------------------------------------------------------------------------------------------------------------

int main(void) {
    int N;
    cin >> N;
    vector<vector<int>> G(N);
    for(int i = 0; i < N; i++) {
        int u, k;
        cin >> u >> k;
        u--;
        for(int i = 0; i < k; i++) {
            int v;
            cin >> v;
            v--;
            G[u].push_back(v);
        }
    }
    for(int i = 0; i < N; i++) {
        for (int j = 0; j < N; j++) {
            int ans = 0;
            for (auto v : G[i]) {
                if(j==v){
                    ans = 1;
                }
            }
            cout << ans;
            if(j<N-1)cout<<' ';
        }
        cout << endl;
    }
}

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


using namespace std;


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


  vector< vector<int> > a;
  for(int i=0;i<n;i++){
    int u;
    int k;
    cin >> u >> k;
    vector<int> tmpa;
    for(int j=0;j<k;j++){
      int tmp;
      cin >> tmp;
      tmpa.push_back(tmp);
    }

    a.push_back(tmpa);
  }

  
  int a2[n][n]={0};  
  for(int i=0;i<n;i++){
    for(int j=0;j<(int)a[i].size();j++){
      a2[i][a[i][j]-1] = 1;
    }
  }

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

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


static const int MAX_NUM = 100 + 1;

int main(void)
{
    int i, j;
    int num;
    int elem;
    int elemnum;
    int tmp;
    int matrix[MAX_NUM][MAX_NUM] = {0};


    scanf("%d", &num);
    for (i = 1; i <= num; i++) {
        scanf("%d %d", &elem, &elemnum);
        for (j = 1; j <= elemnum; j++) {
            scanf("%d", &tmp);
            matrix[elem][tmp] = 1;
        }
    }

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

    return 0;
}

C++: #include <iostream>

using namespace std;



int main() {

	int a[100][100] = {{0}};

	int n;

	cin >> n;

	int u, k, v;

	for ( int i = 0; i < n; i++ ) {

		cin >> u >> k;

		for ( int j = 0; j < k; j++ ) {

			cin >> v;

			a[u - 1][v - 1] = 1;

		}

	}

	for ( int i = 0; i < n; i++ ) {

		for ( int j = 0; j < n; j++ ) {

			cout << a[i][j];

			if ( j != n - 1 ) cout << " ";

		}

		cout << endl;

	}

}

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

int n;
int M[101][101];
int main() {
    cin >> n;

    for (int i = 0; i < n; ++i) {
        int v, k;
        cin >> v >> k;
        for (int j = 0; j < k; ++j) {
            int s;
            cin >> s;
            M[v][s] = 1;
        }
    }

    for (int l = 1; l <= n; ++l) {
        for (int i = 1; i <= n; ++i) {
            cout << M[l][i];
            if (l != n && i != n) cout << " ";
        }
        cout << endl;
    }

    return 0;
}

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_name;
		cin >> point_name;
		v[i].push_back(point_name);
		int adj_point_number;
		cin >> adj_point_number;
		v[i].push_back(adj_point_number);
		for (int j = 0;j < adj_point_number;j++) {
			int adj_point_name;
			cin >> adj_point_name;
			v[i].push_back(adj_point_name);

		}

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

using namespace std;

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