Go: package main

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

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	n, err := nextInt(sc)
	if err != nil {
		panic(err)
	}
	matrix := make([][]int, n)
	for i := 0; i < n; i++ {
		matrix[i] = make([]int, n)
		id, err := nextInt(sc)
		if err != nil {
			panic(err)
		}
		vNum, err := nextInt(sc)
		if err != nil {
			panic(err)
		}
		for j := 0; j < vNum; j++ {
			v, err := nextInt(sc)
			if err != nil {
				panic(err)
			}
			matrix[id-1][v-1] = 1
		}
	}
	for i := 0; i < n; i++ {
		printRow(matrix[i])
	}
}

func printRow(row []int) {
	xs := make([]string, len(row))
	for i := 0; i < len(row); i++ {
		xs[i] = strconv.Itoa(row[i])
	}
	fmt.Println(strings.Join(xs, " "))
}

func nextInt(sc *bufio.Scanner) (int, error) {
	sc.Scan()
	return strconv.Atoi(sc.Text())
}

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

using namespace std;

typedef long long int ll;
typedef pair<ll, ll> pll;

#define FOR(i, n, m) for(ll (i)=(m);(i)<(n);++(i))
#define REP(i, n) FOR(i,n,0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll) 1e15;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N;
    cin >> N;
    vector<vector<ll>> edge(N, vector<ll>(N, 0));
    REP(_, N) {
        ll n, k;
        cin >> n >> k;
        n--;
        REP(__, k) {
            ll v;
            cin >> v;
            v--;
            edge[n][v]++;
        }
    }

    REP(i, N) {
        REP(j, N) {
            cout << edge[i][j];
            if (j < N - 1)
                cout << " ";
        }
        cout << endl;
    }
    return 0;
}

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

bool c[128][128];

int main(void) {

  int n;
  int u;
  int k;
  int v;

  std::cin >> n;
  for(int i = 1; i <= n; ++i) {
    std::cin >> u >> k;
    for(int j = 1; j <= k; ++j) {
      std::cin >> v;
      c[u][v] = true;
    }
  }

  for(int i = 1; i <= n; ++i) {
    for(int j = 1; j <= n-1; ++j) {
      if( c[i][j] ) {
        std::cout << "1 ";
      }
      else {
        std::cout << "0 ";
      }
    }
    if( c[i][n] ) {
      std::cout << "1" << std::endl;
    }
    else {
      std::cout << "0" << std::endl;
    }
  }

  return 0;
}

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

int n;
vector<vector<int> > g;
int ans[101][101];

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

C++: #include<iostream>
#define SIZE 100

using namespace std;

int main(void) {

	int n, c, v;
	int G[SIZE][SIZE];
	int A[SIZE][SIZE];

	cin >> n;

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

	for (int i = 0; i < n; i++) {
		cin >> v;
		cin >> c;
		for (int j = 0; j < c; j++) {
			cin >> G[v-1][j];
			int tmp = G[v-1][j];
			if (tmp > 0) {
				A[v-1][tmp - 1] = 1;
			}
		}
	}

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

C++: #include <iostream>
using namespace std;
int main(){
	int N;
	cin>>N;
	int u,k;
	int v[k];
	int G[N][N];
	for(int i=0;i<N;++i)
		for(int j=0;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[j];
			G[v[j]-1][u-1]=1;  //??£??\????????????ID??§??????"u"???1???????§????????????§?????????????????????u-1??¨?????????
		}	
	}
	for(int i=0;i<N;++i){
		for(int j=0;j<N;++j){
			cout <<G[j][i]<< " ";
		}
		cout<<endl;
	}
}

C++: #include <stdio.h>
#include <string.h>
#define N 110
int m[N][N];
int n;
int main(){
    for(int i = 0 ; i <= n; i++) for(int j = 0; j <= n; j++) m[i][j] = 0;
    scanf("%d", &n);
    for(int p = 0; p < n; p++){
        int node, k;
        scanf("%d %d", &node, &k);
        for(int i = 0; i < k; i++){
            int b;
            scanf("%d", &b);
            m[node][b] = 1;
        }
    }
    for(int i = 1; i <= n; i++){
        for(int j = 1; j <= n; j++){
            if(j != n) printf("%d ", m[i][j]);
            else printf("%d\n", m[i][j]);
        }
    }
    return 0;
}

C++: #include <iostream>

using namespace std;

int p[100+10][100+10];
int n,a,b,c;

int main(){
	cin >> n;
	for (int i=1; i<=n; i++){
		cin >> a >> b;
		for (int j=1; j<=b; j++){
			cin >> c;
			p[a][c] = 1;
		}
	}
	
	for (int i=1; i<=n; i++){
		for (int j=1; j<=n; j++){
			if (j>1) {cout << ' ';}
			cout << p[i][j];
		}
		cout << endl;
	}
}

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

  return 0;
}

C++: #include <stdio.h>

int main() {
    int n, m, tmp;
    
    scanf("%d", &n);
    
    int M[100][100];
    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++) {
        scanf("%d", &m);
        for (int j=0; j<,; j++) {
            scanf("%d", &tmp);
            M[i][tmp-1] = 1;
        }
    }
    
    for(int i=0; i<n; i++) {
        for(int j=0; j<n; j++) {
            if(j) printf(" ");
            printf("%d", M[i][j]);
        }
        printf("\n");
    }
    
    return 0;
}