Go: package main
import (
	"fmt"
	"bufio"
	"os"
	"bytes"
	"strconv"
	"strings"
)

func nextInt(scanner *bufio.Scanner) int {
	scanner.Scan()
	num , _ :=  strconv.Atoi(scanner.Text())
	return num
}


func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)

	N := nextInt(scanner)
	var A [][]int = make([][]int, N)
	for i:=0; i<N; i++ {
		A[i] = make([]int, N)
	}
	for i:=0; i<N; i++{
		idx := nextInt(scanner)
		cnt := nextInt(scanner)
		for j:=0; j<cnt; j++ {
			node := nextInt(scanner)
			A[idx-1][node-1] = 1
		}
	}
	var outBuffer bytes.Buffer
	for i:=0; i<N; i++ {
		outBuffer.WriteString(strings.TrimRight(fmt.Sprintf("%v",A[i])[1:], "]") + "\n")
	}
	fmt.Printf("%s", outBuffer.String())
}

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

int main(){
    int n,a[101][101],u,k,v;
    cin>>n;
    for(int i=1;i<=n;i++){
        for(int j=1;j<=n;j++){
            a[i][j]=0;
        }
    }
    for(int i=0;i<n;i++){
        cin>>u>>k;
        for(int j=0;j<k;j++){
            cin>>v;
            a[u][v]=1;
        }
    }
    for(int i=1;i<=n;i++){
        for(int j=1;j<=n;j++){
            cout<<a[i][j]<<((j==n)?'\n':' ');
        }
    }
}

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

int M[101][101];

int main(){
  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>
using namespace std;
typedef pair<int,int> p;


int main(void){
  int n,a,b,c;
  cin >> n;
  int v[n][n];
  for(int i=0;i<n;i++){
    cin >> a >> b;
    for(int j=0;j<b;j++){
      cin >> c;
      v[a-1][c-1]=1;
    }
  }
  for(int i=0;i<n;i++){
    for(int j=0;j<n;j++){
      if(v[i][j]!=1)cout << 0 << ' ';
      else cout << v[i][j] << ' ';
    }
    cout << endl;
  }
  return 0;
}

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

using namespace std;

int main(void){
  int size,vnum,adjnum,adj;
  cin>>size;
  vector<vector<int>> adjmat(size,vector<int>(size));
  for(int i=0;i<size;i++){
    cin>>vnum>>adjnum;
    for(int j=0;j<adjnum;j++){
      cin>>adj;
      adjmat.at(vnum-1).at(adj-1)=1;
    }
  }

  for(int i=0;i<size;i++){
    for(int j=0;j<size-1;j++) cout<<adjmat.at(i).at(j)<<" ";
    cout<<adjmat.at(i).at(size-1)<<endl;
  }

  return 0;
}

C++: #include <iostream>
#include <string>
#include <map>
#include <set>
#include <algorithm>
using namespace std;
#define MAX 100000

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

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

using namespace std;

#define FOR(i, a, b) for(ll i = (a); i < (b); ++i)
#define FORR(i, a, b) for(ll i = (a); i > (b); --i)
#define REP(i, n) for(ll i = 0; i < (n); ++i)
#define REPR(i, n) for(ll i = n; i >= 0; i--)
#define FOREACH(x, a) for(auto &(x) : (a))
#define VECCIN(x)                                                              \
    for(auto &youso_ : (x)) cin >> youso_
#define mp make_pair
#define bitcnt __builtin_popcount
#define SZ(x) ((ll)(x).size())
#define All(a) (a).begin(), (a).end()
template <typename T = long long> inline T IN() {
    T x;
    cin >> x;
    return (x);
}
inline void CIN() {}
template <class Head, class... Tail>
inline void CIN(Head &&head, Tail &&... tail) {
    cin >> head;
    CIN(move(tail)...);
}
#define CINT(...)                                                              \
    int __VA_ARGS__;                                                           \
    CIN(__VA_ARGS__)
#define LCIN(...)                                                              \
    ll __VA_ARGS__;                                                            \
    CIN(__VA_ARGS__)
#define SCIN(...)                                                              \
    string __VA_ARGS__;                                                        \
    CIN(__VA_ARGS__)
#define Yes(a) cout << (a ? "Yes" : "No") << "\n"
#define YES(a) cout << (a ? "YES" : "NO") << "\n"

typedef long long ll;
typedef unsigned long long ul;
typedef vector<int> V;
typedef vector<ll> VL;
typedef pair<ll, ll> PL;
typedef priority_queue<ll> PQ;
typedef priority_queue<ll, V, greater<ll>> PQG;

const int INF = 1e9;
const int MOD = 1e9 + 7;
// const int MOD = 998244353;
const ll LINF = 1e18;

ll N, M;
vector<VL> G;
vector<bool> went;
ll ans = 0;

void dfs(ll now, ll cnt) {
    if(cnt == N) {
        ans++;
        cout << now << "\n";
    }
    FOREACH(to, G[now]) {
        if(!went[to]) {
            went[to] = true;
            dfs(to, cnt + 1);
            went[to] = false;
        }
    }
}
signed main() {
    cin >> N;
    G.assign(N, VL(N, 0));
    REP(i, N) {
        LCIN(u, k);
        u--;
        REP(j, k) { G[u][IN() - 1] = 1; }
    }
    REP(i, N) {
        REP(j, N) { cout << G[i][j] << " "; }
        cout << "\n";
    }
    return 0;
}

C++: #include<iostream>
int main()
{
  int n;
  int u,k,v;
  int V[100][100]={0};
  std::cin>>n;
  for(int i=0;i<n;i++){
    std::cin>>u>>k;
    for(int j=0;j<k;j++){
      std::cin>>v;
      V[u-1][v-1]=1;
    }
  }
  for(int i=0;i<n;i++){
    for(int j=0;j<n-1;j++){
      std::cout<<V[i][j]<<" ";
    }
    std::cout<<V[i][n-1]<<'\n';
  }
  return 0;
}

C++: #include <iostream>

int main(){
	int n,k,u,v;
	bool G[100][100] = {};
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>u>>k;
		for(int j=0;j<k;j++){
			cin>>v;
			G[u-1][v-1]=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>
using namespace std;

int main() {
	
	int n;
	int **mat;
	
	cin>>n;
	mat = new int*[n];
	for(int i=0;i<n;++i){
		mat[i] = new int[n];
	}
	
	for(int i=0;i<n;++i){
		int id,k,v;
		cin>>id;
		cin>>k;
		
		for(int j=0;j<k;++j){
			cin>>v;
			
			mat[id-1][v-1] = 1;
		}
	}
	
	for(int i=0;i<n;++i){
		for(int j=0;j<n;++j){
			cout<<(j?" ":"")<<mat[i][j];
		}
		cout<<endl;
	}
	
	return 0;
}

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

using namespace std;

int main(){
    int n, u, k, v, adj[LIST_SIZE][LIST_SIZE] = {};

    cin >> n;
    for(int i = 0; i < n; i++){
        cin >> u >> k;
        while(k--){
            cin >> v;
            adj[u-1][v-1] = 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;
    }

    return 0;
}

C++: #include <iostream>

using namespace std;

int main(){

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

  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>
#define ll long long
using namespace std;

int main() {
    ll n;
    cin >> n;
    vector<vector<ll>> mat(n,vector<ll>(n,0));
    for(ll i=0;i<n;i++) {
        ll u,k;
        cin>>u>>k;
        for(ll j=0;j<k;j++) {
            ll tmp;
            cin>>tmp;
            mat[u-1][tmp-1] = 1;
        }
    }
    for(ll i=0;i<n;i++) {
        for(ll j=0;j<n;j++) {
            if(j<n)cout << mat[i][j] << " ";
            else cout << mat[i][j] << " ";
        }
        cout << endl;
    }
}