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 <bits/stdc++.h>
using namespace std;

int main() {
    int n; cin >> n;
    vector<vector<int>> vec(n, vector<int>(n, 0));

    for (int i = 0; i < n; i++)
    {
        int u, k, tmp; cin >> u >> k;
        for (int j = 0; j < k; j++)
        {
            cin >> tmp;
            vec.at(i).at(tmp-1)=1;
        }
        
    }
    
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < n; j++)
        {
            cout << vec.at(i).at(j) ;
            if(j!=n-1) cout << " ";
        }
        cout << endl;
    }
    
}
//g++ -o a.exe a.cpp

C++: #include <stdio.h>

int map_max;
int map[110][110];
int rows;
int cols[110];
int mat[110][110];

void get_map();
void print_map();
void conv_map();
void print_mat();

int main()
{

  get_map();
  //print_map();
  conv_map();
  print_mat();
  return 0;
}

void get_map()
{

  int k;
  scanf("%d", &map_max);//<100

  for(int i=0;i<map_max;i++)
    {
      scanf("%d", &k);
      scanf("%d", &cols[i]);
      for(int j=0;j<cols[i];j++)
	{
	  map[i-1][j-1]=0;
	  scanf("%d", &map[i-1][j-1]);
	}
    }

  
  return ;
}

void print_map()
{
  for(int i=0;i<map_max;i++)
    {
      for(int j=0;j<cols[i];j++)
	{
	  printf("%d", map[i-1][j-1]);
	}
      puts("");
    }
return ;
}


void conv_map()
{
  for(int i=0;i<map_max;i++)
    {
      for(int j=0;j<cols[i];j++)
	{
	  mat[i][map[i-1][j-1]-1]=1;
	}
    }
  return ;
}

void print_mat()
{
  for(int i=0;i<map_max;i++)
    {
      for(int j=0;j<map_max;j++)
	{
	  printf("%d", mat[i][j]);
	  if(j!=map_max-1)
	    {
	      printf(" ");
	    }
	}
      if(i!=map_max-1)
	{
      printf("\n");
	}
    }
}

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

int a[101][101] = {0}; //???????????????u??¨u?????£??\?????????????????????v

int main() {
  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][v] = 1;
    }
  }

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

      cout << ' ';
    }
    cout << '\n';
  }
}

C++: #define _CRT_SECURE_NO_WARNINGS
#include <cstdio>
#include <cstdlib>
#include <string>
#include <iostream>
#include <climits>

using namespace std;


int main() {
	int n;
	int u, v;
	int Adj[101][101];
	int deg;
	cin >> n;
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= n; j++) {
			Adj[i][j] = 0;
		}
	}
	for (int i = 1; i <= n; i++) {
		cin >> u;
		cin >> deg;
		for (int j = 1; j <= deg; j++) {
			cin >> v;
			Adj[u][v] = 1;
		}
	}
	for(int i = 1; i <= n; i++) {
		for (int j = 1; j <= n; j++) {
			printf("%d ", Adj[i][j]);
		}
		printf("\n");
	}
}

C++: #include <iostream>
using namespace std;
int adj[100][100] = {0};
int main()
{
	int n;
	cin >> n;
	for (int i=0;i<n;i++) {
		int j, k;
		cin >> j >> k;
		j--;
		for (int m=0;m<k;m++) {
			int a;
			cin >> a;
			a--;
			adj[j][a]=1;
		}
	}

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

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

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

C++: // 最長共通部分列 問題
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<stack>
#include<algorithm>
#include<iostream>
#include<cmath>
#include<vector>

using namespace std;

#define MAX_N 100
// 無効な値の定義
const int INV = -1;

int main(void)
{
    int n, u, num, v_num;
    int ary_graph[MAX_N + 1][MAX_N + 1];

    for(int i = 0; i < MAX_N + 1; i++)
    {
        for(int j = 0; j < MAX_N + 1; j++)
        {
            // 配列の初期化
            ary_graph[i][j] = 0;
        }
    }

    cin >> n;

    for(int i = 0; i < n; i++)
    {
        cin >> u;
        cin >> num;

        for(int j = 0; j < num; j++)
        {
            // 隣接点を記憶する
            cin >> v_num;
            ary_graph[u][v_num] = 1;
        }
    }

    // 結果の表示をする
    for(int i = 1; i <= n; i++)
    {
        for(int j = 1; j <= n; j++)
        {
            if( j > 1 )
            {
                cout << " ";
            }

            cout << ary_graph[i][j];
        }

        cout << endl;
    }

    return 0;
}

C++: #include<iostream>
#include<map>
#include<vector>
#include<algorithm>
#include<cmath>
#include<climits>
#include<ctime>
#include<cstring>
#include<stack>
#include<queue>
#include<sstream>
#include<string>
#include<set>
#include<array>
#include<cassert>

#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define DUMP(list) cout << "{ "; for(auto nth : list){ cout << nth << " "; } cout << "}" << endl
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i);

using namespace std;

int main(){
	
	int n;
	cin >> n;
	vector<vector<int>> ans(n,vector<int>(n,0));

	rep(i,n){
		int u,k;
		cin >> u >> k;	
		u--;
		rep(j,k){
			int v;
			cin >> v;
			v--;
			ans[u][v]=1;
		}
	}

	rep(i,n){
		rep(j,n-1){
			cout << ans[i][j] << " ";	
		}
		cout << ans[i][n-1] << endl;
	}

	return 0;
}

C++: #include <stdio.h>
#define N 101

int main(){

  int u,k,i,j,v,n;
  int a[N][N];
 
  scanf("%d",&n);

  for(i=1;i<=n;i++){
    scanf("%d",&u);
    scanf("%d",&k);
    for(j=1;j<=k;j++){
      scanf("%d",&v);
      a[u][v]=1;
    }
  }
  
  for(i=1;i<=N;i++){
    for(j=1;j<=N;j++){
      if(a[i][j]==NULL)a[i][j]=0;
    }
  }
  
  for(i=1;i<=n;i++){
    for(j=1;j<n;j++){
      printf("%d ",a[i][j]);
    }
    printf("%d\n",a[i][n]);
  }

  return 0;

}