Go: package main

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

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)
	scanner.Scan()
	n, _ := strconv.Atoi(scanner.Text())
	Adj := make([][]int, n)
	for i := range Adj {
		Adj[i] = make([]int, n)
	}
	for i := 0; i < n; i++ {
		scanner.Scan()
		u, _ := strconv.Atoi(scanner.Text())
		scanner.Scan()
		k, _ := strconv.Atoi(scanner.Text())
		if k == 0 {
			continue
		}
		for i := 0; i < k; i++ {
			scanner.Scan()
			v, _ := strconv.Atoi(scanner.Text())
			Adj[u-1][v-1] = 1
		}
	}
	for i := range Adj {
		for j := range Adj[i] {
			fmt.Printf(" %d", Adj[i][j])
			if j == n-1 {
				fmt.Println()
			}
		}
	}
}

C++: #include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")

#define rep(i,n) for(int i=0;i<n;i++)
const long long MOD = 1000000007;

int main(){
  int n; cin >> n;
  int graph[n][n] = {};
  int k,f;
  rep(i,n){
    cin >> f >> k;
    rep(j,k){
      int ai; cin >> ai;
      graph[i][ai-1] = 1;
    }
  }
  rep(i,n){
    rep(j,n){
      cout << graph[i][j];
      if(j != n-1) cout << " ";
    }
    cout << "\n";
  }
}

C++: #include <iostream>
using namespace std;
int G[101][101];
int n,v,k,p;
int main(){
	cin >>n;
	for(int i=0;i<n;i++){
		cin >> v>>k;
		for(int j=0;j<k;j++){
			cin >> p;
			G[v][p]=1;
		}
	}
	for(int i=1;i<=n;i++){
		for(int j=1;j<n;j++){
			cout << G[i][j]<<" ";
		}
		cout << G[i][n]<<endl;
	}
}

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>

using namespace std;
 
void main() {
	int Adj[100][100];
	int n, u, k, v;
	cin >> n;

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

C++: #include <iostream>

using namespace std;

int main(){
  int n,k, u, v;

  cin >> n;
  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;
   u--;

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

 for(int i=0; i<n;i++){
   for(int j=0;j< n ; j++){
     cout << g[i][j];
      if(j!= n-1){
       cout<<" ";
     }
   }
   cout << endl;
 }

 return 0;
}

C++: #include <iostream>
#include <string>
#include <vector>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <functional>
#include <map>
#include <cmath>
#include <queue>

using namespace std;

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

    int n;scanf("%d",&n);
    int u;
    int k;
    vector<vector<int> > graph;
    graph.resize(n);
    for(int i=0;i<n;i++){
        graph[i].resize(n);
    }
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            graph[i][j]=0;
        }
    }

    for(int i=0;i<n;i++){
        scanf("%d",&u);
        scanf("%d",&k);
        int value;
        for(int j=0;j<k;j++){
            scanf("%d",&value);
            graph[u-1][value-1]=1;
        }
    }

    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            printf("%d ",graph[i][j]);
        }
        if(i!=n-1) {
            printf("\n");
        }
    }

    return 0;
}

C++: #include <iostream>

using namespace std;
int main(){
    int n;
    cin >> n;
    int mat[n][n] = {};
    for(int i = 0; i < n; ++i){
        int id;
        cin >> id;
        int k;
        cin >> k;
        int v;
        for(int j = 0; j < k; ++j){
            cin >> v;
            mat[id-1][v-1] = 1;
        }
    }
    for(auto x : mat){
        for(int i = 0; i < n; ++i){
            if(i == 0){
                cout << x[i];
            } else {
                cout << ' ' << x[i];
            }
        }
        cout << endl;
    }
}

C++: #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
//#define ll long long
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
#define rep(i, n) REP(i, 0, n)
#define rep_rev(i, n) for (int (i) = (int)(n) - 1 ; (i) >= 0 ; --(i))
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
#define all(x) (x).begin(),(x).end()
ll tmp1,tmp2,tmp3;
const ll mod = 1000000007;
const int INF = 1e9;
const ll INFLONG = 1e18;
void swap(ll *x,ll *y){
  ll tmp;
  tmp = *x;
  *x = *y;
  *y = tmp;
}
int main(){
  ll n;
  cin >> n;
  vector<vector<ll>> vec(n,vector<ll>(n,0));
  ll u,k,v;
  rep(i,n){
    cin >> u >> k;
    rep(j,k){
      cin >> v;
      vec[u-1][v-1] = 1;
    }
  }

  rep(i,n){
    rep(j,n){
      cout << vec[i][j];
      if(j != n-1){
        cout << " ";
      }
    }
    cout << endl;
  }
}

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

int main(){
        int N;
        cin >> N;
        int a[110][110]={{0}};
        for(int i=0; i<N; i++){
                int v,n;
                cin >> v;
                cin >> n;
                for(int j=0; j<n; j++){
                        int V;
                        cin >> V;
                        a[v-1][V-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;
        }
}

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

int main() {
  int N, u, k, v;
  int A[100][100];

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

  cin >> N;

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

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

  return 0;
}

C++: #include <iostream>

using namespace std;

int main(){

  int n,u,k,v,graph[106][106]={{}};

  cin >> n ;

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

  for(int i = 1; i<= u; i++){
    for(int j = 1; j<= u; j++){
      cout << graph[i][j] << ' ' ; 
    }
    cout << endl;
  }


  return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
int main(){
	int n;
	int a[101][101];
	memset(a,0,sizeof(a));
	cin>>n;
	int u,k;
	for(int i = 0;i < n;i++){
		cin>>u>>k;
		u--;
		for(int j=0;j<k;j++){
			int x;
			cin>>x;
			x--;
			a[u][x]=1;
		}
	}
	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
			if(j)cout<<" ";
			cout<<a[i][j];
		}
		cout<<endl;
	}
}