Go: package main

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

var sc = bufio.NewScanner(os.Stdin)

func scanInt() int {
	num, _ := strconv.Atoi(scanString())
	return num
}

func scanString() string {
	sc.Scan()
	return sc.Text()
}

func init() {
	sc.Split(bufio.ScanWords)
}

func main() {
	n := scanInt()
	arr := make([][]int, n)
	for i := 0; i < n; i++ {
		u := scanInt()
		k := scanInt()
		arr[u-1] = make([]int, n)
		for j := 0; j < k; j++ {
			n := scanInt()
			arr[u-1][n-1] = 1
		}
	}

	w := bufio.NewWriter(os.Stdout)
	for _, col := range arr {
		fmt.Fprintln(w, strings.Trim(fmt.Sprint(col), "[]"))
	}
	w.Flush()
}

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

bool A[110][110];

int main (){
	int n,a,b,c;
	cin>>n;
	for(int i=1;i<=n;i++){
			for(int j=1;j<=n;j++){
				A[i][j]=false;
		}
	}
	for(int i=1;i<=n;i++){
		cin>>a>>b;
		for(int j=1;j<=b;j++){
			cin>>c;
			A[a][c]=true;
		}
	}
	for(int i=1;i<=n;i++){
		for(int j=1;j<=n;j++){
			cout<<A[i][j]<<(j==n?"\n":" ");
		}
	}
	return 0;
}

C++: #include<bits/stdc++.h>
#define ll long long int
#define FOR(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define REP(i,n) FOR(i,0,n)
#define REP1(i,n) FOR(i,1,n)
using namespace std;

static const int N = 100;

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

  cin >> n;

  REP(i, n) {
    REP(j, n) {
      M[i][j] = 0;
    }
  }

  REP(i, n) {
    cin >> u >> k;
    u--;
    REP(j, k) {
      cin >> v;
      v--;
      M[u][v] = 1;
    }
  }

  REP(i, n) {
    REP(j, n) {
      if ( j ) cout << " ";
      cout << M[i][j];
    }
    cout << endl;
  }

  return 0;
}

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

int main(){
    int n;
    scanf("%d",&n);
    int arr[n][n];
    for(int i = 0; i < n; i++){
        for(int j = 0; j < n; j++){
            arr[i][j] = 0;
        }
    }
    for(int i = 0; i < n; i++){
        int u,k;
        scanf("%d %d",&u,&k);
        for(int j = 0; j < k; j++){
            int v;
            scanf("%d",&v);
            arr[u-1][v-1] = 1;
        }
    }
    for(int row = 0; row < n; row++){
        for(int column = 0; column < n; column++){
            printf("%d",arr[row][column]);
            if(column != n-1){
                printf(" ");
            }
        }
        printf("\n");
    }
}

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

const int MAX_N = 100;

int main() {
  int N;
  int G[MAX_N][MAX_N];
  cin >> 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++) {
    int tmp, n;
    cin >> tmp >> n;
    for (int j=0; j<n; j++) {
      int t;
      cin >> t; t--;
      G[i][t] = 1;
    }
  }

  for (int i=0; i<N; i++) {
    for (int j=0; j<N-1; j++) {
      cout << G[i][j] << " ";
    }
    cout << G[i][N-1] << endl;
  }

  return 0;
}

C++: #include<iostream>
#include<map>
#include<vector>
#include<algorithm>
#include<cmath>
#include<climits>
#include<ctime>
#include<cstring>
#include<numeric>

#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define dump(a) (cerr << #a << "=" << (a) << endl)
#define DUMP(list) cout << "{ "; for(auto nth : list){ cout << nth << " "; } cout << "}" << endl;

using namespace std;

int main() {
	int n, u, k;
	cin >> n; 

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

	return 0;
}

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

int main(){
  int n; cin >> n;

  vector<vector<int>> v(n);
  for(int i=0; i<n; ++i) v[i].resize(n);

  for(int i=0; i<n; ++i){
    int u, k; cin >> u >> k;
    while(k--){
      int x; cin >> x;
      v[u-1][x-1] = 1;
    }
  }

  for(int i=0; i<n; ++i){
    for(int j=0; j<n; ++j){
      cout << (j != 0 ? " " : "") << v[i][j];
    }
    cout << endl;
  }
}

C++: #include <stdio.h>

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

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>
using namespace std;

static const int N = 100;

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

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

    return 0;
}

C++: #include<bits/stdc++.h>
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<iostream>
#include<algorithm>
using namespace std;
bool point[100][100];

int main()
{
	int num,n1,n2,n3;
	cin >> num;
	for (int i = 0; i < num; i++) {
		cin >> n1 >> n2;
		for (int k = 0; k < n2; k++) {
			cin >> n3;
			point[n1 - 1][n3 - 1] = 1;
		}
	}
	for (int i = 0; i < num; i++) {
		for (int k = 0; k < num; k++) {
			if (k) { cout <<" "; }
			cout << point[i][k];
		}
		cout << endl;
	}
	
}

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

#define MAX 100

int G[MAX + 1][MAX + 1];

int main() {
  int n;
  cin >> n;

  for ( int i = 1; i <= n; i++ ) {
    int m; cin >> m;
    int n; cin >> n;
    for ( int j = 1; j <= n; j++ ) {
      int k; cin >> k;
      G[i][k] = 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 main(){
    int num;
    cin >> num;
    bool A[num+1][num+1];
    
    for(int i=1; i<=num; i++){
        for(int j=1; j<=num; j++){
            A[j][i] = false;
        }
    }
    
    for(int i=1; i<=num; i++){
        int node;
        int n;
        cin >> node >> n;
        for(int j=1; j<=n; j++){
            int a;
            //cin >> A[i][j];
            cin >> a;
            A[node][a] = true;
            }
    }
    
    for (int i=1; i<=num; i++){
        for(int j=1; j<=num; j++){
            if(j-1!=0) {
            cout << ' ';
            }
            if(A[i][j]){
            cout << '1' ;
            }
            else{
            cout << '0';
            }
        }
        cout << endl;
    }
    
    return 0;
}