Go: package main

import "fmt"

func main() {
	var N int
	fmt.Scan(&N)
	graph := make([][]int, N)
	for i := range graph {
		graph[i] = make([]int, N)
		var u, k int
		fmt.Scan(&u, &k)
		for j := 0; j < k; j++ {
			var v int
			fmt.Scan(&v)
			v--
			graph[i][v] = 1
		}
	}
	for i := 0; i < N; i++ {
		for j := 0; j < N; j++ {
			if j > 0 {
				fmt.Print(" ")
			}
			fmt.Print(graph[i][j])
		}
		fmt.Println()
	}
}

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

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

}

C++: #include <stdio.h>
#define rep(i, n) for(int i = 0; i < n; ++i)

int main(void) {
  int n, i, j;
  scanf("%d", &n);
  char r[n][n];
  rep(i, n) rep(j, n) r[i][j] = 0;
  rep(i, n) {
    int u, k;
    scanf("%d%d", &u, &k);
    u--;
    rep(j, k) {
      int v;
      scanf("%d", &v);
      v--;
      r[u][v] = 1;
    }
  }
  rep(i, n) {
    rep(j, n - 1) printf("%d ", r[i][j]);
    printf("%d\n", r[i][n - 1]);
  }
  return 0;
}

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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  int n;
  cin >> n;

  int G[101][101];
  int u, v, k;

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

  return 0;
}

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

int n;
int M[101][101];
int main() {
    cin >> n;

    for (int i = 0; i < n; ++i) {
        int v, k;
        cin >> v >> k;
        for (int j = 0; j < k; ++j) {
            int s;
            cin >> s;
            M[v][s] = 1;
        }
    }

    for (int l = 1; l <= n; ++l) {
        for (int i = 1; i <= n; ++i) {
            cout << M[l][i] << " " ;
        }
        cout << endl;
    }

    return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
#define P(x) cout << (x) << endl
#define p(x) cout << (x)
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define vv(type, c, m, n, i) vector<vector<type>> c(m, vector<type>(n, i));
#define rep(i,a,n) for(int i=(a), i##_len=(n); i<i##_len; ++i)
#define rrep(i,a,n) for(int i=(a), i##_len=(n); i>i##_len; --i)
#define len(x) ((int)(x).size())
#define mp make_pair
#define eb emplace_back
typedef long long ll;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<long long> vll;
typedef vector<string> vs;
typedef vector<bool> vb;
int main() {
	int n; cin >> n;
	vv(int, v, n + 1, n + 1, 0);
	int index, num, k;
	rep(i, 0, n) {
		cin >> index >> num;
		rep(j, 0, num) {
			cin >> k;
			++v[index][k];
		}
	}
	rep(i, 1, n + 1) {
		rep(j, 1, n + 1) {
			cout << v[i][j] << (j == n ? "\n" : " ");
		}
	}
	return 0;
}

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

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

	cin >> n;

	for ( i = 0; i < n; i++ ) {
		for ( j = 0; j < n; j++ ) {
			M[i][j] = 0;
		}
	}

	for ( i = 0; i < n; i++ ) {
		cin >> u >> k;
		u--;
		for ( j = 0; j < k; j++ ) {
			cin >> v;
			v--;
			M[u][v] = 1;
		}
	}

	for ( i = 0; i < n; i++ ) {
		for ( j = 0; j < n; j++ ) {
			if( j ) cout << " ";
			cout << M[i][j];
		}
		cout << endl;
	}

	return 0;
}

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

int main() {
	int n;
	cin >> n;
	bool G[n + 1][n + 1];
	for (int i = 1; i <= n; i++)
		for (int j = 1; j <= n; j++)
			G[i][j] = false;
	for (int i = 0; i < n; i++) {
		int u, k;
		cin >> u >> k;
		for (int j = 0; j < k; j++) {
			int v;
			cin >> v;
			G[u][v] = true;
		}
	}
	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<stdio.h>

int main(){
  int n,i,j,l,u,k;
  int v[101][101];
  int a[101][101];
  scanf("%d",&n);

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

       return 0;
  }

C++: #include<iostream>
using namespace std;
int m[101][101];
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n,u,k,v;
  cin>>n;
  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<bits/stdc++.h>
#define ll long long
#define INF 0x3f3f3f3f
using namespace std;
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>
using namespace std;
int main(){
  int n,k,u,num;
  int g[150][150]={};
	
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>u>>k;
    for(int j=0;j<k;j++){
      cin>>num;
      g[u][num]=1;          //numは各頂点を表す。
    }
  }
	
  for(int i=1;i<=n;i++){
	for(int j=1;j<=n;j++){
		cout<<g[i][j];
		if(j!=n){
			cout<<" ";
		}
	}
  	cout<<"\n";
  }
	return 0;
}

C++: #include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<array>
#include<iomanip>
#define rep(i,n) for(int i=0;i<n;i++)
typedef int long long ll;

using namespace std;
int main(){


    int n;
    cin>>n;
    int ar[n+1][n+1];
    for(int i=0;i<n+1;i++){
        for(int j=0;j<n+1;j++){
            ar[i][j]=0;
         
        }
    }
    
    for(int i=1;i<n+1;i++){
        
        int x,y;
        cin>>x>>y;
        for(int j=0;j<y;j++){
            int t;
            cin>>t;
            ar[x][t]=1;
        }
    }
    
    for(int i=1;i<n+1;i++){
        for(int j=1;j<n+1;j++){
            cout<<ar[i][j];
            if(j!=n)cout<<" ";
            else cout<<endl;
        }
    }




return 0;
}

C++: 
#include <iostream>
using namespace std;
int main() {
    int n,p,q;
    cin>>n;
    int A[100][100]={0};
    for (int i=0;i<n;i++){
        cin>>q>>p;
        if (p==0)
            continue;
        for (int j=0;j<p;j++){
            int x;
            cin>>x;
            A[q][x-1]=1;
        }
    }
    
    
    for (int i=0;i<n;i++){
        for (int j=0;j<n;j++){
            cout<<A[i][j];
            if (j!=n-1)cout<<" "; 
        }
        cout<<endl;
    }
    return 0;
}