Go: package main

/*
グラフの表現 隣接行列による表現
*/

import (
	"bufio"
	"fmt"
	"log"
	"os"
	"strconv"
	"strings"
)

func main() {
	scanner := makeScanner(8192)
	n := eGetInt(scanner)
	g := make([][]int, n)
	for i := 0; i < n; i++ {
		g[i] = make([]int, n)
		ints := eGetInts(scanner)
		num := ints[0]
		for j := 0; j < ints[1]; j++ {
			g[num-1][ints[j+2]-1] = 1
		}
	}
	for i := 0; i < n; i++ {
		s := fmt.Sprint(g[i])
		fmt.Println(s[1 : len(s)-1])
	}
}

////////////////////////////////////////////////////////////////////////////////
// ライブラリ
////////////////////////////////////////////////////////////////////////////////
func makeScanner(maxByte int) *bufio.Scanner {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Buffer(make([]uint8, 0, 8192), maxByte)
	return scanner
}
func makeWordScanner() *bufio.Scanner {
	scanner := makeScanner(8192)
	scanner.Split(bufio.ScanWords)
	return scanner
}
func eGetLine(r *bufio.Scanner) string {
	if r.Scan() {
		return r.Text()
	}
	err := r.Err()
	if err != nil {
		log.Fatal(err)
	}
	// EOF
	return ""
}
func eGetInt(r *bufio.Scanner) int {
	line := eGetLine(r)
	return eAtoi(line)
}
func eGetInt64(r *bufio.Scanner) int64 {
	line := eGetLine(r)
	return eAtoInt64(line)
}
func eGetFields(r *bufio.Scanner) []string {
	line := eGetLine(r)
	return strings.Fields(line)
}
func eGetInts(r *bufio.Scanner) []int {
	fields := eGetFields(r)
	ints := make([]int, len(fields))
	for i := 0; i < len(ints); i++ {
		ints[i] = eAtoi(fields[i])
	}
	return ints
}
func eGetInt64s(r *bufio.Scanner) []int64 {
	fields := eGetFields(r)
	ints := make([]int64, len(fields))
	for i := 0; i < len(ints); i++ {
		ints[i] = eAtoInt64(fields[i])
	}
	return ints
}
func eGetChars(r *bufio.Scanner) []string {
	line := eGetLine(r)
	return strings.Split(line, "")
}
func eAtoi(s string) int {
	n, err := strconv.Atoi(s)
	if err != nil {
		log.Fatal(err)
	}
	return n
}
func eAtoInt64(s string) int64 {
	n, err := strconv.ParseInt(s, 10, 64)
	if err != nil {
		log.Fatal(err)
	}
	return n
}

C++: #include <stdio.h>
int A[100][100];
int main(void){
  int k,j,n,u,v,uv,V;
  scanf("%d",&V);
  for(n=0;n<V;n++){
    scanf("%d%d",&u,&k);
    for(j=0;j<k;j++){
      scanf("%d",&v);
      A[u-1][v-1]=1;
    }
  }
  for(v=0;v<V;v++){
    
    for(uv=0;uv<V;uv++){
      if(uv!=0){
	printf(" ");
      }
      printf("%d",A[v][uv]);
    }
    printf("\n");
  }
  
  return 0;
}

C++: 
#include <iostream>
#include <math.h>
#include <algorithm>
using namespace std;

int A[101][101];

int main() {
	int n;
	cin >> n;
	for (int t = 0; t < n; t++) {
		int i, k;
		cin >> i >> k;
		for (int s = 0; s < k; s++) {
			int j;
			cin >> j;
			A[i][j] = 1;
		}
	}
	for (int i = 1; i < n + 1; i++) {
		for (int j = 1; j < n + 1; j++) {
			if (j != 1)cout << ' ';
			cout << A[i][j];
		}
		cout << endl;
	}
	return 0;
}

C++: #include <iostream>
#include <cstdlib>

using namespace std;


struct node {
    int id;
    node *next;
};


node hdrs[101];
int adj[101][101];


int main()
{
    int n;
    cin >> n;
    for (int i = 1; i <= n; i++) {
        hdrs[i].next = &hdrs[i];
        hdrs[i].id = i;
    }

    for (int i = 1; i <= n; i++) {
        int k;
        int id;
        cin >> id >> k;
        for (int j = 0; j < k; j++) {
            int v;
            cin >> v;

            node *t = (node *)malloc(sizeof(node));
            t->id = v;
            t->next = hdrs[id].next;
            hdrs[id].next = t;
        }
    }

    for (int i = 1; i <= n; i++) {
        node *t = &hdrs[i];
        while (t->next != &hdrs[i]) {
            t = t->next;
            adj[i][t->id] = 1;
        }
    }

    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++: #define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <list>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <queue>
#include <iomanip>
#define INF 2147483647
 
using namespace std;

int main(void)
{
	int n, k, u, v;
	int G[101][101];

	cin >> n;

	memset(G, 0, sizeof(G));

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

	return (0);
}

C++: #include <iostream>
#include <vector>

using namespace std;

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

    vector<vector<int>> neighbor(n, vector<int>(n));
    for (int i = 0; i < n; i++) {
        int u, k;
        cin >> u >> k;
        for (int j = 0; j < k; j++) {
            int x;
            cin >> x;
            neighbor[u - 1][x - 1] = 1;
        }
    }

    for (int i = 0; i < neighbor.size(); i++) {
        for (int j = 0; j < neighbor[i].size(); j++) {
            if (j > 0)
                cout << " ";
            cout << neighbor[i][j];
        }
        cout << endl;
    }

    return 0;
}

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

using namespace std;

int main() {
    //freopen("in.txt", "r", stdin);
    int n;
    cin >> n;
    vector<vector<int> > G(n + 1, vector<int>(n + 1, 0));
    for (int i = 0; i < n; i++) {
        int u, k;
        cin >> u >> k;
        int v;
        for (int j = 0; j < k; j++) {
            cin >> v;
            G[u][v] = 1;
        }
    }
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= n; j++) {
            if (j < n) cout << G[i][j] << " ";
            else cout << G[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 <iostream>
#include <stdio.h>

#define MAX 101

int main() {
    int n;
    int M[MAX][MAX];
    scanf("%d", &n);
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= n; j++) {
            M[i][j] = 0;
        }
    }
    
    for (int i = 1; i <= n; i++) {
        int id, k;
        scanf("%d %d", &id, &k);
        if (k == 0) continue;
        else {
            for (int j = 1; j <= k; j++) {
                int v; scanf("%d", &v);
                M[id][v] = 1;
            }
        }
    }
    
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= n; j++) {
            if (j == n) printf("%d\n", M[i][j]);
            else printf("%d ", M[i][j]);
        }
    }
    
    return 0;
}

C++: #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repr(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define FORR(i, m, n) for (int i = (m); i >= (n); --i)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
const ll mod2 = 998244353;
const int INF = 1000000005;


int main() {
  int n, u, k, v;
  cin >> n;
  bool G[n][n];
  rep(i, n) {
    rep(j, n) {
      G[i][j] = false;
    }
  }
  rep(i, n) {
    cin >> u >> k;
    rep(i, k) {
      cin >> v;
      G[u-1][v-1] = true;
    }
  }

  rep(i, n) {
    rep(j, n) {
      if (j) cout << " ";
      cout << G[i][j];
    }
    cout << endl;
  }


  
  return 0;
}