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 <iostream>
using namespace std;
int T[105][105];
int main()
{
    int t;
    cin>>t;
    int m=t;
    while(t--)
    {
        int ori;
        cin>>ori;
        int n;
        cin>>n;
        while(n--)
        {
            int x;
            cin>>x;
            T[ori][x]=1;
        }
    }
    for(int i=1;i<=m;i++)
    {
        cout<<T[i][1];
        for(int j=2;j<=m;j++)
            cout<<" "<<T[i][j];
        cout<<endl;
    }
    return 0;
}

C++: #include <iostream>
#define MAX 101

using namespace std;

int main(){
  int n, i, j, k, l, m;
  bool g[MAX][MAX];
  
  for(i=1;i<MAX;++i){
    for(j=1;j<MAX;++j)
      g[i][j] = false;
  }
  
  cin >> n;
  for(i=1;i<=n;++i){
    cin >> k >> l;
    for(j=1;j<=l;++j){
      cin >> m;
      g[k][m] = true;
    }
  }
  
  for(i=1;i<=n;++i){
    for(j=1;j<=n;++j){
      cout << g[i][j];
      if(n != j)cout << " ";
    }
    cout << "\n";
  }
  
  return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
int main(){
  int n,a[100][100]={0},i,j,b,c,q;
  for(cin>>n,i=0;i<n;i++){
    cin>>b>>q;b--;
    for(j=0;j<q;j++){
      cin>>c;
      a[b][--c]=1;
    }
  }
  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      if(j)cout<<' ';
      cout<<a[i][j];
    }
    cout<<endl;
  }
}

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

void fnInput(vector<vector<int>> &rvvnAdjcy)
{
  int nMaxSiz;
  cin >> nMaxSiz;

  rvvnAdjcy.resize(nMaxSiz + 1, vector<int>(nMaxSiz + 1, 0));
  for (int i = 0; i < nMaxSiz; i++)
  {
    int nx, nSecSiz;
    cin >> nx >> nSecSiz;
    for (int j = 0; j < nSecSiz; j++)
    {
      int ny;
      cin >> ny;
      rvvnAdjcy[nx][ny] = 1;
    }
  }
}

void fnResult(const vector<vector<int>> &cnrvvnAdjcy)
{
  for (int i = 1; i < cnrvvnAdjcy.size(); i++)
  {
    for (int j = 1; j < cnrvvnAdjcy[i].size(); j++)
    {
      if (j != 1) cout << " ";
      cout << cnrvvnAdjcy[i][j];
    }
    cout << endl;
  }
}

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  vector<vector<int>> vvnAdjcy;

  fnInput(vvnAdjcy);
  fnResult(vvnAdjcy);

  return 0;
}

C++: #include<stdio.h>
int main (){

}

C++: #include <stdio.h>

#define VerticesNum 100
typedef unsigned int uint;



int main(void){
    uint Graph[VerticesNum][VerticesNum] = {};
    
    uint uVertices;
    scanf("%u", &uVertices);
    
    for(uint i = 0; i < uVertices; i++)
    {
        uint uVertexIdx;
        uint OutDegree;
        scanf("%u", &uVertexIdx);
        scanf("%u", &OutDegree);
        for(uint j = 0; j < OutDegree; j++)
        {
            uint AdjacentVertex;
            scanf("%u", &AdjacentVertex);
            Graph[uVertexIdx - 1][AdjacentVertex - 1] = 1; 
        }
    }
    
    for(uint i = 0; i < uVertices; i++)
    {
        for(uint j = 0; j < uVertices; j++)
        {
            printf("%u", Graph[i][j]);
            (j < (uVertices - 1))
                ? printf(" ")
                : printf("\n");
        }
    }
    
    return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;

const double pi  = 2 * acos(0.0);
const double eps = 1e-8;

#define REP(i,a,b) for(int i=(a); i<(b);++i)
#define rep(i,n) REP(i,0,n)
#define INF (1<<29)
#define INFLL (1L<<29)

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

typedef int Cost;
struct Edge {
  int src, dst; Cost cost;
  Edge(int s, int d, Cost c) : src(s), dst(d), cost(c) {}
};
typedef vector<Edge>  Edges;
typedef vector<Edges> Graph;
typedef vector<Cost>  Array;
typedef vector<Array> Matrix;

int dx[8] = {0, 1, 0, -1, 1, -1, 1, -1};
int dy[8] = {1, 0, -1, 0, 1, -1, -1, 1};

#define MAX_N 101

int G[MAX_N][MAX_N];

int main(void) {
  ios_base::sync_with_stdio(false); cin.tie(0);
  int n; cin >> n;
  rep(i, n) {
    int u, k;
    cin >> u >> k;
    rep(j, k) {
      int node_num; cin >> node_num;
      G[u][node_num] = 1;
    }
  }
  REP(i, 1, n + 1) {
    REP(j, 1, n + 1) {
      if (j != 1) cout << " ";
      cout << G[i][j];
    }
    cout << endl;
  }
  return 0; 
}

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

using namespace std;

int main(){
  int n;
  cin >> n;
  int i;
  int a[150][150];
  int x,y;
  for (x = 0; x < n; x++) {
    for (y = 0; y < n; y++) {
      a[x][y]=0;
    }
  }

  for (i = 0; i < n; i++) {
    int l;
    cin >> l;
    int k;
    cin >> k;
    int j;
    for (j = 0; j < k; j++) {
      int m=0;
      cin >> m;
      a[l-1][m-1]=1;
    }

  }

  for (x = 0; x < n; x++) {
    for (y = 0; y < n; y++) {
      printf("%d ",a[x][y]);
    }printf(" ");;
  }

  return 0;
}

C++: #include<iostream>
using namespace std;
static const int N = 100;

int main(){
    int A[N][N];
    int a,b,c,d;
    cin >> a;
    for(int i=0;i<a;i++){
        for(int j=0;j<a;j++)A[i][j]=0;

    }

    for(int i=0;i<a;i++){
        cin >> b >> c;
        b--;
        d--;
        for(int j=0;j<c;j++){
            cin>>d;
            d--;
            A[b][d]=1;
        }
    }

    for(int i=0;i<a;i++){
        for(int j=0;j<a;j++){
            if(j)cout<<" ";
            cout<<A[i][j];
        }
        cout <<endl;
    }
    return 0;
}

C++: #include<iostream>

using namespace std;

#define ll long long

int main(){
    ll n, u, k, v;
    cin >> n;
    ll A[n][n];
    for (ll i=0; i<n; i++){
        for(ll j=0; j<n; j++){
            A[i][j] = 0;
        }
    }
    for(ll i=0; i<n; i++){
        cin >> u;
        cin >> k;
        for(ll j=0; j<k; j++){
            cin >> v;
            A[u-1][v-1] = 1;
        }
    }

    for (ll i=0; i<n; i++){
        for(ll j=0; j<n; j++){
            cout << A[i][j];
            if(j<n-1){
                cout << ' ';
            }
        }
        cout << '\n';
        }
    }
}