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 <cstdio>
#include <cstdlib>
#include <cassert>
#include <string>
#include <cstring>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>

using namespace std;

// ---------------------
// repetition
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)

// debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

// ---------------------
#define INF 922337203685477580
typedef long long ll;

int matrix[110][110];

int main() {
  REP(x, 110) {
    REP(y, 110) {
      matrix[x][y] = 0;
    }
  }


  int n;
  cin >> n;

  REP(_, n) {
    int v, num;
    cin >> v >> num;

    REP(i, num) {
      int cv;
      cin >> cv;
      matrix[v][cv] = 1;
    }
  }


  FOR(x, 1, n + 1) {
    FOR(y, 1, n + 1) {
      cout << " " << matrix[x][y];
    }
    cout << endl;
  }

  return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
static void line(int32_t n, vector<int32_t> &v) {
  auto &&it = v.cbegin();
  for (int32_t i = 0; i < n; ++i) {
    cout << (i == 0 ? "" : " ");
    if (!v.empty() && it != v.cend() && i + 1 == *it) {
      cout << 1;
      ++it;
    } else {
      cout << 0;
    }
  }
  cout << endl;
}
int main() {
  int32_t n;
  cin >> n;
  for (int32_t i = 0; i < n; ++i) {
    int32_t skip, k;
    cin >> skip >> k;
    vector<int32_t> v(k);
    for (int32_t j = 0; j < k; ++j) {
      cin >> v[j];
    }
    sort(v.begin(), v.end());
    line(n, v);
  }
}

C++: #include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>

using namespace std;

//??\???????????????
//4
//1 2 2 4
//2 1 4
//3 0
//4 1 3

bool Path[101][101] = {false};

int main(){
    int  N;
    cin >> N;
    int bb;
    for (int i = 1; i <= N; i++) {
        int K;
        scanf("%d %d",&bb,&K);
        for (int k = 0; k < K; k++) {
            int p;
            scanf("%d",&p);
            
            Path[i][p] = true;
        }
    }
    
    for (int r = 1; r <= N; r++) {
        for (int c = 1; c <= N; c++) {
            printf("%d",Path[r][c]);
            if (c != N) printf(" ");
        }
        printf("\n");
    }
    return 0;
}

C++: #include<stdio.h>

int G[101][101];

int main()
{
    int n, i, j, a, b, e;
    scanf("%d", &n);
    for(i = 1; i <= n; i++){
		for(j = 1; j <= n; j++){ G[i][j] = 0; } }

    for(i = 1; i <= n; i++){ scanf("%d %d", &a, &e);
		for(j = 1; j <= e; j++){ scanf("%d", &b); G[a][b] = 1; } }

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

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

int gra[101][101];
int n, a, b, c;

int main(){
 cin>>n;
 for(int i=0; i<n; i++){
  cin>>a>>b;
  for(int j=1; j<=b; j++){
   cin>>c;
   gra[a][c]=1;
  }  
 }
 for(int i=1; i<=n; i++){
  for(int j=1; j<n; j++)
   cout<<gra[i][j]<<" ";
  cout<<gra[i][n]<<"\n";
 }
 return 0;
}

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

using namespace std;

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

	long u,v;
	long  nn;

	vector<vector<int>> g(n + 1, vector<int>(n + 1,0));
	for (int i = 1; i <= n; i++) {

		cin >> u;
		cin >> nn;
		for (int j = 1; j <= nn; j++) {

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

	return 0;

}

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

bool G[101][101];

int main(){
    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;
            G[u][v] = 1;
        }
        
    }
    
    for (int i = 1; i <= n; i++)
    {
        cout << G[i][1];
        for (int j = 2; j <= n; j++)
        {
            cout << " " << G[i][j];
        }
        cout << endl;
    }
}

C++: #include<iostream>
using namespace std;
int main()
{
	int degree,number,num,count;
	cin>>degree;
	int arr[100][100];
	for(int i=0;i<degree;i++)
	{
		for(int j=0;j<degree;j++)
		{
			arr[i][j]=0;
		}
	}
	for(int i=0;i<degree;i++)
	{
		cin>>count;
		cin>>number;
		for(int j=0;j<number;j++)
		{
			cin>>num;
			arr[i][num-1]=1;
		}
	}
	for(int i=0;i<degree;i++)
	{
		for(int j=0;j<degree;j++)
		{
			cout<<arr[i][j];
			if(j!=degree-1)
				cout<<" ";
		}
		cout<<endl;
	}
}

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

//??£??\?????????????¬??????????????¨???¶???	array[i][j] i??????j???????????????
//??£??\?????????????????????????????????????????????,?????????????¨???¶
//ALDS1_11-A
int n,u,k,a;
int map[101][101];
int main(){
	for(int i=0;i<101;i++){
		for(int j=0;j<101;j++){
			map[i][j]=0;
		}
	}
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>u;
		cin>>k;
		for(int j=0;j<k;j++){
			cin>>a;
			map[u][a]=1;
		}
	}
	for(int i=1;i<n+1;i++){
		for(int j=1;j<n+1;j++){
			cout<<map[i][j]<<" ";
			if(j==n&&i!=n)cout<<endl;
		}
	}
	return 0;
}

C++: /*
 * Problem Description: Graph I - Graph
 * Category: Graph
 * Author: Khan
 * Date: 18th October, 2017
 */

#include <iostream>
#include <cstring>
#include <algorithm>

#define MAXN 100

using namespace std;

int main(int argc, char const *argv[])
{
    //freopen("sample.txt", "r", stdin);
    int n, G[MAXN + 1][MAXN + 1], t;
    memset(G, 0, sizeof(G));
    cin >> n;
    for (int i = 0; i < n; ++i)
    {
        cin >> t >> t;
        int tmp;
        for (int j = 0; j < t; ++j)
        {
            cin >> tmp;
            G[i + 1][tmp] = 1;
        }
    }
    for (int i = 0; i < n; ++i)
    {
        for (int j = 0; j < n; ++j)
        {
            if(j != 0)
                cout << " ";
            cout << G[i + 1][j + 1];
        }
        cout << endl;
    }
    return 0;
}