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<algorithm>
#include<stdio.h>
#include<stdlib.h>

using namespace std;
static const int N = 100;

int main(){
    int n, u, k, v;
    int M[N][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++){
        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;
    
}

C++: #include <cstdio>

int main(void) {
    int n, u, k, v, i, j;
    scanf("%d", &n);
    int m[n+1][n+1];

    for (i = 1; i <= n; i++)
        for (j = 1; j <= n; j++)
            m[i][j] = 0;

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

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

    return 0;
}

C++: #include <iostream>
using namespace std;
static const 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;
}

C++: #include<bits/stdc++.h>
#define ll long long
#define rep(i, n) for(int i=0;i<(n);++i)
#define per(i, n) for(int i=(n)-1;i>=0;--i)
#define repa(i, n) for(int i=1;i<(n);++i)
#define foreach(i, n) for(auto &i:(n))
#define pii pair<int, int>
#define pll pair<long long, long long>
#define all(x) (x).begin(), (x).end()
#define bit(x) (1ll << (x))
const ll MOD = (ll)1e9+7;
const int INF = (ll)1e9+7;
const ll INFLL = (ll)1e18;
using namespace std;
template<class t>
using vvector = vector<vector<t>>;
template<class t>
using vvvector = vector<vector<vector<t>>>;
template<class t>
using priority_queuer = priority_queue<t, vector<t>, greater<t>>;
template<class t, class u> bool chmax(t &a, u b){if(a<b){a=b;return true;}return false;}
template<class t, class u> bool chmin(t &a, u b){if(a>b){a=b;return true;}return false;}

ll modpow(ll x, ll b){
	ll res = 1;
	while(b){
		if(b&1)res = res * x % MOD;
		x = x * x % MOD;
		b>>=1;
	}
	return res;
}

ll modinv(ll x){
	return modpow(x, MOD-2);
}

bool was_output = false;
template<class t>
void output(t a){
	if(was_output)cout << " ";
	cout << a;
	was_output = true;
}
void outendl(){
	was_output = false;
	cout << endl;
}

int main(){
	int n;
	cin >> n;
	vvector<int> ans(n, vector<int>(n, 0));
	rep(i, n){
		int t;
		cin >> t;
		--t;
		int time;
		cin >> time;
		rep(j, time){
			int to;
			cin >> to;
			--to;
			ans[t][to] = 1;
		}
	}

	foreach(i, ans){
		foreach(j, i){
			output(j);
		}
		outendl();
	}
	return 0;
}

C++: #include<iostream>
using namespace std;
int graph[105][105];
int main()
{
	int n;
	cin>>n;
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<n;j++)
			graph[i][j]=0;
	}
	for(int i=1;i<=n;i++)
	{
		int v;
		cin>>v;
		int num;
		cin>>num;
		while(num--)
		{
			int aa;
			cin>>aa;
			graph[v-1][aa-1]=1;
			//cout<<v-1<<" "<<aa<<endl;
		}
	}
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<n;j++)
		{
			if(j>0)
			cout<<" ";
			cout<<graph[i][j];
		}
		cout<<endl;
	}
	return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
int main(){
  int a[101][101]={};
  int n,u,k,v;
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>u>>k;
    for(int j=0;j<k;j++){
      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<<a[i][n]<<endl;
  }
  return 0;
}

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

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

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

   return 0;
}

C++: #include<iostream>
using namespace std;
static const 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;
}

C++: #include<bits/stdc++.h>
#define rep(i,n) for(int i=0; i<n; i++)
#define rrep(i,n) for(int i=n-1; i>=0; i--)

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef long double lb;

const int INF=1<<27;
const int MOD=(int)1e9+7;

int main(void)
{
    int n, u, v, k, a[101][101]={0}, adj[101];

    cin >> n;
    rep(i,n){
        cin >> u >> k;
        rep(i,k){
            cin >> v;
            a[u][v] = 1;
        }
    }

    rep(i,n){rep(j,n) cout << a[i+1][j+1] << ' '; cout << endl;}
    return 0;
}

C++: #include <stdio.h>
#include <iostream>
#include <string>
using namespace std;
int main(){
	int n;
	cin >> n;

	int G[100][100] = {};
	for(int i=0; i<n; i++){
		int u,k;
		cin >> u >> k;
		for(int l=0; l<k; l++){
			int v;
			cin >> v;
			G[u-1][v-1] = 1;
		}
	}

	for(int i=0; i<n; i++){
		for(int l=0; l<n; l++){
			cout << G[i][l];
			if(l==n-1){
				cout << endl;
			}
			else{
				cout << " ";
			}
		}
	}

	return 0;
}