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<vector>
#include<cstdio>
using namespace std;
int judge(int i, int n, int variable, vector< vector<int> > &v)
{
	for (int j = 0; j<v[variable].size(); ++j) {
		if (i == v[variable][j]) {
			return 1;
			break;
		}
	}
	return 0;
}
int main()
{
	int n, u, k, vv;
	cin >> n;
	vector< vector<int> > v(n), a(n, vector<int>(n));
	for (int variable = 0; variable<n; ++variable) {
		cin >> u >> k;
		for (int i = 0; i<k; ++i) {
			cin >> vv;
			v[variable].push_back(vv);
		}
	}
	for (int variable = 0; variable<n; ++variable)
		for (int i = 1; i <= n; ++i)
			a[variable][i - 1] = judge(i, n, variable, v);
	for (int variable = 0; variable<n; ++variable)
		for (int i = 0; i<n; ++i)
			printf("%d%c", a[variable][i], i == n - 1 ? "\n" : " ");
}

C++: #include <stdio.h>

int main(void){
    int n;
    scanf("%d", &n);

    int V[101][101];
    for(int i = 1; i <= 100; i++){
        for(int j = 1; j <= 100; j++){
            V[i][j] = 0;
        }
    }

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

        int n;
        scanf("%d", &n);

        int num2;
        for(int j = 0; j < n; j++){
            scanf("%d", &num2);
            V[num1][num2] = 1;
        }
    }

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

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

struct edge{
    int node;
    edge *next;
}nodes[105];

int n,matrix[105][105];

int main()
{
    memset(matrix,0,sizeof(matrix));
    cin>>n;
    int i,j;
    for(i=1;i<=n;i++){
        int ii,n_i;
        cin>>ii>>n_i;
        for(j=0;j<n_i;j++){
            int jj;
            cin>>jj;
            matrix[ii][jj]=1;
        }
    }
    for(i=1;i<=n;i++){
        for(j=1;j<=n;j++){
            if(j!=1)cout<<" ";
            cout<<matrix[i][j];
        }
        cout<<endl;
    }
    return 0;
}

C++: #include <iostream>

using namespace std;

int main(){
	int graph[100][100] = {0};
	int num;
	int hon;
	int eda;
	int ver;

	cin>>num;
	for(int i=0;i<num;i++){
		cin>>eda;
		cin>>hon;
		for(int j=0;j<hon;j++){
			cin>>ver;
			graph[eda][ver]++;
		}
	}
	for(int i=1;i<=num;i++){
		for(int j=1;j<=num;j++){
			cout<<graph[i][j];
			if(j==num)
				break;
			cout<<" ";
		}
		cout<<endl;
	}

	return 0;
}

C++: #include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;
const int MAXN = 100 + 4;
int M[MAXN][MAXN];
int main()
{
    int n, k, u, m;
    memset ( M, 0, sizeof(M) );
    cin>>n;
    for ( int i = 0; i < n; i++ ) {
        cin>>u>>k;
        for ( int j = 0; j < k; j++ ){
            cin>>m;
            M[u][m] = 1;
        }
    }

    for ( int i = 1; i <= n; i++ ) {
        for ( int j = 1; j <= n; j++ ) {
            if ( j == 1 ) cout<<M[i][j];
            else cout<<' '<<M[i][j];
        }
        cout<<endl;
    }
    return 0;
}

C++: #include <iostream>

using namespace std;

const int N = 100;

int main()
{
    int n, c_num, row, column;
    int adj[N][N] = {};
    cin >> n;

    for (int i = 0; i < n; i++)
    {
        cin >> row >> c_num;
        for (int j = 0; j < c_num; j++)
        {
            cin >> column;
            adj[row-1][column-1] = 1;
        }
    }

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

C++: #include<iostream>
using namespace std;
static const int N = 100;

int main() {
	int M[N][N]; // 0 オリジンの隣接行列
	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--; // 0 オリジンへ変換
		for ( int j = 0; j < k; j++ ) {
			cin >> v;
			v--; // 0 オリジンへ変換
			M[u][v] = 1; // u と v の間に辺を張る
		}
	}
	
	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 <vector>
#include <cmath>
#include <string>
#include <algorithm>
#include <iomanip>
#include <map>
#include <bitset>
#include <cstdio>
#include <set>
#include <stack>
#include <queue>
#include <cassert>
#include <numeric>
using namespace std;
typedef long long ll;
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> istream &operator>>(istream &is, vector<T> &v){ for (auto &x : v) is >> x; return is; }
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
    REP(i,v.size()){if(i)os<<" ";os<<v[i];}return os;}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
    REP(i,v.size()){if(i)os<<endl;os<<v[i];}return os;}
#define vi vector<int>
#define vii vector<vector<int>>
#define mii map<int,int>
#define Sort(v) sort(v.begin(),v.end())
#define Reverse(v) reverse(v.begin(),v.end())
#define ALL(a)  (a).begin(),(a).end()
#define pb push_back
#define mp make_pair
//#define int ll

const int md = 1000000007;
const int INF = 1<<30;



int main(){
    int n; cin >> n;
    vector<vector<int>> e(n,vector<int>(n,0));
    rep(i,n){
        int a; cin >> a;
        int tmp; cin >> tmp;

        rep(j,tmp) {
            int to; cin >> to;
            e[i][to-1] = 1;
        }
    }

    cout << e << endl;
}