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>
using namespace std;

int main(){
  int n, u, k, v, a[100][100] = {0};
  cin >> n;
  for(int i=0;i<n;i++){
    cin >> u;
    cin >> 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++){
      if(j-1) cout << " ";
      cout << a[i][j];
    }
    cout << endl;
  }
  return 0;
}

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

static const int N = 100;

int main(void) {
	int M[N][N];
	int n, u, k, v;

	scanf("%d", &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++) {
		scanf("%d%d", &u, &k);
		u--;//0オリジンへ変換する
		for (int j = 0; j < k; j++) {
			scanf("%d", &v);
			v--;
			M[u][v] = 1;
		}
	}

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

	return 0;
}

C++: #include<stdio.h>

#define MAX 100

int G[MAX+1][MAX+1];

int main() {
    int n;
    scanf("%d", &n);
    for (int i = 1; i <= n; ++i) {
        for (int j = 1; j <= n; ++j) {
            G[i][j] = 0;
        }
    }
    for (int i = 0; i < n; ++i) {
        int u,k;
        scanf("%d %d", &u, &k);
        for (int j = 0; j < k; ++j) {
            int t;
            scanf("%d", &t);
            G[u][t] = 1;
        }
    }
    for (int i = 1; i <= n; ++i) {
        for (int j = 1; j <= n; ++j) {
            if (j > 1) printf(" ");
            printf("%d",G[i][j]);
        }
        printf("\n");
    }
}

C++: #define _CRT_SECURE_NO_WARNINGS

#include<iostream>
#include<functional>
#include<algorithm>
#include<stack>
#include<queue>
#include<iomanip>
#include<set>
#include<map>
#include<utility>
#include<string>
#include<vector>

using namespace std;

#define LL long long

bool adj[101][101]={};
int n;

int main() {
	cin>>n;
	for(int i=0;i<n;i++){
		int u,k;
		cin>>u>>k;
		for(int j=0;j<k;j++){
			int v;
			cin>>v;
			adj[u][v]=true;
		}
	}
	for(int i=1;i<=n;i++){
		for(int j=1;j<n;j++){
			cout<<adj[i][j]<<" ";
		}
		cout<<adj[i][n]<<endl;
	}
	return 0;
}

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

int main()
{
	int n;
	cin >> n;
	int matrix[n][n];
	for(int i=0; i<n; i++){
		for(int j=0; j<n; j++){
			matrix[i][j] = 0;
		}
	}

	for(int i=0; i<n; i++){
		int u, k, v;
		cin >> u >> k;
		for(int j=0; j<k; j++){
			cin >> v;
			matrix[u-1][v-1] = 1;
		}
	}
		
	for(int i=0; i<n; i++){
		for(int j=0; j<n; j++){
			cout << matrix[i][j] << " ";
		}
		cout << endl;
	}

	return 0;
}

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

const long N = 100;

int main(){
	long n;
	cin >> n;
	long c[N + 1][N + 1];
	for (long i = 1; i <= n; i++){
		for (long j = 1; j <= n; j++){
			c[i][j] = 0;
		}
	}
	for (long i = 1; i <= n; i++){
		long u, k;
		cin >> u >> k;
		long m[N];
		for (long j = 1; j <= k; j++){
			cin >> m[j];
			c[u][m[j]] = 1;
		}
	}
	for (long i = 1; i <= n; i++){
		for (long j = 1; j <= n; j++){
			if (j - 1) cout << " ";
			cout << c[i][j];
		}
		cout << endl;
	}
}

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

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

  int mat[n][n];
  for(int i=0;i<n;i++)
    for(int j=0;j<n;j++)
      mat[i][j]=0;

  int u, k;
  cin >> u >> k;
  for(int i=0;i<k;i++){
    mat[u-1][k-1]=1;
  }

  for(int i=0;i<n;i++){
    cout << mat[i-1][0];
    for(int j=1;j<n;j++)
      cout << ' ' << mat[i-1][j];
    cout << endl;
  }
}

C++: #include<bits/stdc++.h>

using namespace std;

int mat[110][110];

int main()
{

    int n;

    cin>>n;

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

        cin>>a>>b;

        for(int j=0;j<b;j++)
        {
            int c;

            cin>>c;

            mat[a][c]=1;
        }
    }

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


    return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
int main(){
  int n,lis[100][100]={};
  cin>>n;
  for(int c=0;c<n;c++){
    int u,k,v;
    cin>>u>>k;
    for(int i=0;i<k;i++){
      cin>>v;
      lis[u-1][v-1]=1;
    }
  }
  for(int i=0;i<n;i++){
    for(int j=0;j<n;j++){
      if(j)cout<<" ";
      cout<<lis[i][j];
    }
    cout<<endl;
  }
  return 0;
}

C++: #include <iostream>
#include <string>
#include <sstream>
#include <queue>
using namespace std;
struct dot{
	long long int k,p,l,r;
};
int main(int argc, char** argv) {
	int n;
	while(cin>>n){
		int d[n][n]={0};
		for(int i=0;i<n;i++){
			int a,b;
			cin>>a>>b;
			a--;
			for(int j=0;j<b;j++){
				int c;
				cin>>c;
				d[i][c-1]=1;
			}
		}
		for(int i=0;i<n;i++){
			for(int j=0;j<n;j++){
				cout<<d[i][j];
				if(j<n-1)
					cout<<" ";
			}
			cout<<endl;
		}
			
				
	}
	return 0;
}

C++: #define scanf_s scanf
#include <string>
#include <stdio.h>
#include <math.h>
#include <stack>
#include <queue>
#include <list>
#include <vector>
#include <iostream>
using namespace std;

#define MAX 100
//#define MAX_ 1000
int main(void)
{
	int G[MAX][MAX] = { false };
	int n, u, k, v;
	scanf_s("%d", &n);
	for (int i = 0; i < n; ++i) {
		scanf_s("%d %d", &u, &k);
		for (int j = 0; j < k; ++j) {
			scanf_s("%d", &v);
			G[u - 1][v - 1] = true;
		}
	}
	for (int i = 0; i < n; ++i) {
		for (int j = 0; j < n; ++j) {
			if (j != 0) printf(" ");
			printf("%d", G[i][j]);
		}
		printf("\n");
	}
}