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 <algorithm>
#include <iostream>
#include <string>
#include <cstring>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <iomanip>
#include <limits>
#include <map>
#include <queue>
#include <stack>
#include <vector>

#define FOR(i,k,n) for(int (i) = (k); (i) < (n); ++(i))
#define rep(i,n) FOR(i,0,n)
#define pb push_back
#define all(v) begin(v), end(v)
#define debug(x) cerr << #x << ": " << x << endl
#define debug2(x,y) cerr << #x << ": " << x << ", " << #y << ": " << y << endl

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<i_i, int> p_i;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
template<class T> using vv=vector<vector<T>>;
typedef deque<int> di;
typedef deque<deque<int>> ddi;


int main() {
    int n;
    bool g[101][101] = {};
    cin >> n;
    rep(i,n) {
        int u,k;
        cin  >> u >> k;
        rep(j,k) {
            int tmp;
            cin >> tmp;
            g[u][tmp] = 1;
        }
    }
    FOR(i,1,n+1) {
        FOR(j,1,n+1) {
            cout << g[i][j] << " ";
        }
        cout << endl;
    }
	return 0;
}

C++: 
#include <iostream>

using namespace std;

int a[110][110];

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

  for(int i = 0; i < n; ++i) {
	for(int j = 0; j < n; ++j) {
	  cout << a[i][j];
	  cout << (j < n - 1 ? " " : "\n");
	}
  }
  return 0;
}

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

int main() {
  int n;
  cin>>n;
  vector<vector<int>>a(n,vector<int>(n,0));
  for(int i=0;i<n;i++){
    int num;
    cin>>num;
    num--;
    int m;
    cin>>m;
    for(int j=0;j<m;j++){
      int x;
      cin>>x;
      x--;
      a[num][x]++;
    }
  }
  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;
}

C++: #include <stdio.h>
#include <iostream>
#include <algorithm>
#include <math.h>
#include <stack>

using namespace std;

int minimum=-1;


int main(){
	int n,row,num,col;
	scanf("%d",&n);
	int table[n][n];
	for(int i=0;i<n;i++){
		for(int k=0;k<n;k++){
			table[i][k] = 0;
		}
	}

	for(int i=0;i<n;i++){
		scanf("%d %d",&row,&num);
		for(int k=0;k<num;k++){
			scanf("%d",&col);
			table[row-1][col-1]=1;
		}
	}

	for(int i=0;i<n;i++){
		for(int k=0;k<n-1;k++){
			printf("%d ",table[i][k]);
		}
		printf("%d\n",table[i][n-1]);
	}

    return 0;
}

C++: #include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <algorithm>
#include <map>
#include <cmath>
#include <list>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>

#define rep(i, n) for (int i = 0; i < n; i++)

using namespace std;

const int INF = 1 << 30;
const int MOD = 1000000007;
const int MAX = 100000;
const int N = 100;

int M[N][N];

int main() {
	int n; cin >> n;
	rep(i, n) rep(j, n) M[i][j] = 0;
	rep(i, n) {
		int _n, n2; cin >> _n >> n2;
		rep(j, n2) {
			int k; cin >> k;
			M[i][k-1] = 1;
		}
	}
	rep(i, n) {
		rep(j, n) {
			if (j < n-1) cout << M[i][j] << ' ';
			else cout << M[i][j];
		}
		cout << endl;
	}
}

C++: #include<bits/stdc++.h>
using namespace std;
#define max(a,b) (a<b?b:a)
#define abs(x) (x<0?(-x):x)
#define F(i,L,R) for (int i = L; i < R; i++)
#define FE(i,L,R) for (int i = L; i <= R; i++)
#define RF(i,L,R) for (int i = L; i > R; i--)
#define RFE(i,L,R) for (int i = L; i >= R; i--)
#define getI(a) scanf("%d", &a)
#define getII(a,b) scanf("%d%d", &a, &b)
#define getIII(a,b,c) scanf("%d%d%d", &a, &b, &c)
#define VgetI(n) int (n); scanf("%d",&(n))
#define VgetII(n,m) int (n),(m); scanf("%d %d",&(n),&(m))
#define VgetIII(n,m,k) int (n),(m),(k); scanf("%d %d %d",&(n),&(m),&(k))
#define ll long long
#define INF 2000000000
#define nINF -2000000000
#define MOD 1e9+7
#define PI 3.1415926535897932384626
bool matrix[1005][1005];
int main(){
	//freopen("test.out","w",stdout);
	int n;
	scanf("%d",&n);
		int maxV=-INF;
		while(n--){
			VgetII(u,k);
			if(u>maxV) maxV=u;
			while(k--){
				VgetI(to);
				if(to>maxV) maxV=to;
				matrix[u-1][to-1]=1;
			}
		}
		F(i,0,maxV){
			F(j,0,maxV) j==maxV-1?printf("%d\n",matrix[i][j]):printf("%d ",matrix[i][j]);
			//if(i!=maxV-1) puts("");
		}
	//fclose(stdout);
}

C++: #include<bits/stdc++.h>
using namespace std;
int main(){
    int n,k,u,d;
    cin>>n;
    vector<vector<int> > Adj(n,vector<int>(n,0));
    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>>k>>u;
        for(int j=0;j<u;j++){
            cin>>d;
            Adj[k-1][d-1]=1;
        }
    }
    
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            cout<<Adj[i][j]<<" ";
        }
        cout<<"\n";
    }
    cout<<endl;
    
    return 0;
}

C++: #include <iostream>
using namespace std;
//using ll = long long;

int main(void) {
  int n; int i, j;
  cin >> n; //頂点の数
  int adj[n+1][n+1]; //隣接リスト
  for (i = 1; i < n+1; i++)
    for (j = 1; j < n+1; j++)
      adj[i][j] = 0;
  
  for (i = 1; i <= n; i++) {
    int u, k;
    cin >> u >> k;
      for (j = 1; j <= k; j++) {
        int m;
        cin >> m;
        adj[u][m]++;
      }
  }
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= n; j++) {
      cout << adj[i][j] ;
      if (j != n) cout << " ";
    }
    cout << endl;
  }
}

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

using namespace std;

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

    vector<bool> A(n*n);
    fill(A.begin(), A.end(), false);

    for (int32_t i = 0; i < n; i++) {
        int32_t u, k;
        cin >> u >> k;

        for (int32_t j = 0; j < k; j++) {
            int32_t v;
            cin >> v;

            A[(u-1)*n+(v-1)] = true;
        }
    }

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

    return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
  int N;
  bool info[100][100] = {{}};
  cin >> N;
  for(int i = 0; i < N; i++){
    int u, k;
    cin >> u >> k;
    while(k--){
      int v;
      cin >> v;
      info[u - 1][v - 1] = true;
    }
  }
  for(int i = 0; i < N; i++){
    for(int j = 0; j < N; j++){
      cout << info[i][j] << (j + 1 == N ? '\n' : ' ');
    }
  }
}