Go: package main

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

//util
var sc = bufio.NewScanner(os.Stdin)

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

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func printList(list []int) {
	n := len(list)
	buf := bufio.NewWriter(os.Stdout)
	for _, v := range list[0 : n-1] {
		buf.Write([]byte(fmt.Sprintf("%d ", v)))
	}
	buf.Write([]byte(fmt.Sprintf("%d\n", list[n-1])))
	buf.Flush()
}

func max(a, b int) int {
	if a > b {
		return a
	} else {
		return b
	}
}

func min(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}

//solve

const MAX = 100

var n int
var A [MAX + 1][MAX + 1]int

func main() {
	sc.Split(bufio.ScanWords)
	n = nextInt()
	for i := 0; i < n; i++ {
		u, k := nextInt(), nextInt()
		A[u-1][u-1] = 0

		//fmt.Println(u, k)
		if k > 0 {
			for j := 0; j < k; j++ {

				v := nextInt()
				A[u-1][v-1] = 1

			}
		}

	}

	for i := 0; i < n; i++ {
		printList(A[i][0:n])
	}

}

C++: #include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)

int main() {
  int n; cin >> n;
  vector<vector<int>> M(n, vector<int>(n));
  rep(i, n) {
    int u, k; cin >> u >> k;
    rep(z, k) {
      int num; cin >> num;
      M.at(i).at(num - 1) = 1;
    }
  }
  rep(i, n){
    rep(j, n-1)cout << M.at(i).at(j) << " ";
    cout << M.at(i).at(n-1) << endl;
  }
}

C++: #include<iostream>
#include<vector>
using namespace std;
int main()
{
    vector<int> l[101];
    int matrix[100][100];
    int n;
    cin>>n;
    for(int i=0;i<n;i++)
    {
        int u,k;
        cin>>u>>k;
        for(int j=0;j<k;j++)
        {
            int tmp;
            cin>>tmp;
            l[u].push_back(tmp);
        }
    }
    
    for(int i=0;i<n;i++)
    {
        for(int j=0;j<n;j++)
        {
            matrix[i][j]=0;
        }
    }
    
    for(int i=1;i<n+1;i++)
    {
        for(int j=0;j<l[i].size();j++)
        {
            matrix[i-1][l[i][j]-1]=1;
        }
    }
    
    for(int i=0;i<n;i++)
    {
        for(int j=0;j<n;j++)
        {
            if(j!=0)
                cout<<" ";
            cout<<matrix[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[N][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;
            G[u-1][v-1]=1;
        }
    }
    for(int i=0;i<N;++i){
        for(int j=0;j<N;++j){
            if(j) cout<<' ';
            cout<<G[i][j];
        }
        cout<<endl;
    }
}

C++: #include <iostream>
using namespace std;
int adj[100][100] = {0};
int main()
{
	int n;
	cin >> n;
	for (int i=0;i<n;i++) {
		int j, k;
		cin >> j >> k;
		j--;
		for (int m=0;m<k;m++) {
			int a;
			cin >> a;
			a--;
			adj[j][a]=1;
		}
	}

	for (int i=0;i<n;i++) {
		for (int j=0;j<n;j++) {
			cout << adj[i][j];
			cout << ' ';
	//		if (j<n) cout << ' ';
		}
	//	cout << endl;
	}
		
	return 0;
}

C++: #include <iostream>
#include <vector>
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 k;
        cin >> k;
        // 1~n???index?????¨????????????????????????????????????1????????????0~n-1????????????
        k -= 1;
        int u;
        cin >> u;
        for(int j=0; j<u; ++j){
            int v;
            cin >> v;
            v -= 1;
            A[k][v] = 1;
        }
    }
    
    for(int i=0; i<n; ++i){
        for(int j=0; j<n; ++j){
            cout << A[i][j] << " ";
        }
        cout << endl;
    }
}

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

typedef long long ll;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    int k,u;
    int v;
    int table[200][200]={};
    for(int i=0;i<n;i++){
        cin >> u;
        cin >> k;
        for(int j=0;j<k;j++){
            cin >> v;
            table[u-1][v-1]=1;
        }
    }
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            if(j)cout << " ";
            cout << table[i][j];
        }
        cout << endl;
    }

    return 0;
}

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

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

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

#define MAX 100005
#define INF INT_MAX

int main(int, char**)
{
    int n;
    cin >> n;

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

C++: #include<iostream>

using namespace std;

int main(){
  int n;
  int u[100];
  int A[100][100] = {};
  
  cin >> n;
  
  for(int i = 0;i < n;i++){
    int k;
    cin >> u[i] >> k;
    int v[k];
    for(int j = 0;j < k;j++){
      cin >> v[j];
      A[i][v[j] - 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 << "\n";
  }
  
  return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <iomanip>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;

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

}

C++: #include "bits/stdc++.h"
using namespace std;
static const int N=100;

int main(){
	int M[N][N]; //0?????????????????????
	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;//u??¨v?????????????????????
			}
		}
		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;

static const int MAX = 100;

int main(){
    int n;
    scanf("%d",&n);
    int u,k,adj[MAX][MAX],tmp;
    memset(adj,0,sizeof(adj));
    for(int i=0;i<n;i++){
        scanf("%d %d",&u,&k);
        for(int m=0;m<k;m++){
            scanf("%d",&tmp);
            adj[i][tmp-1] = 1;
        }
    }
    for(int i=0;i<n;i++){
        for(int m=0;m<n;m++){
            if(m) printf(" ");
            printf("%d",adj[i][m]);
            if(m==3) printf("\n");
        }
    }

    return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
int main(){
    int n,k,u,d;
    cin>>n;
    vector<vector<int>> Adj(n,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>>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";
    }
    
    return 0;
}