Go: package main

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

func getScanner(fp *os.File) *bufio.Scanner {
	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 500001), 500000)
	return scanner
}

func getNextString(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}

func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}

func main() {
	fp := os.Stdin
	if len(os.Args) > 1 {
		fp, _ = os.Open(os.Args[1])
	}

	scanner := getScanner(fp)
	writer := bufio.NewWriter(os.Stdout)

	n := getNextInt(scanner)
	g := make([][]int, n)

	for i := 0; i < n; i++ {
		g[i] = make([]int, n)
	}

	for i := 0; i < n; i++ {
		u := getNextInt(scanner)
		k := getNextInt(scanner)
		u--
		for ii := 0; ii < k; ii++ {
			v := getNextInt(scanner)
			v--
			g[u][v] = 1
		}
		fmt.Fprintln(writer, joinint(g[u], " "))
	}

	writer.Flush()
}

func joinint(a []int, sep string) string {
	n := len(a)
	ss := make([]string, n)
	for i := 0; i < n; i++ {
		ss[i] = fmt.Sprintf("%d", a[i])
	}
	return strings.Join(ss, sep)
}

C++: #include <bits/stdc++.h>
#define rep(i, a, b) for (int i = a; i < (b); i++)
#define rrep(i, a, b) for (int i = a; i >= (b); i--)
#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
using P = pair<int, int>;
template <class T>
inline bool chmin(T& a, T b) {
   if (a > b) {
      a = b;
      return true;
   }
   return false;
}
template <class T>
inline bool chmax(T& a, T b) {
   if (a < b) {
      a = b;
      return true;
   }
   return false;
}
void hr() {
   cerr << "--------------" << endl;
}
const int INF = 1001001001;
const int MOD = 1000000007;

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

   int n;
   cin >> n;
   vector<vector<int>> G(n, vector<int>(n));
   rep(i, 0, n) {
      int u, k;
      cin >> u >> k;
      u--;
      rep(j, 0, k) {
         int v;
         cin >> v;
         v--;
         G[u][v] = 1;
      }
   }
   rep(i, 0, n) rep(j, 0, n) printf("%d%c", G[i][j], j == n - 1 ? '\n' : ' ');
   return 0;
}

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

void fnInput(vector<vector<int>>& rvvnAdjcy)
{
  int nMaxSiz;
  cin >> nMaxSiz;

  rvvnAdjcy.resize(nMaxSiz + 1, vector<int>(nMaxSiz + 1, 0));
  for (int i = 0; i < nMaxSiz; i++)
  {
    int nx, nSecSiz;
    cin >> nx >> nSecSiz;
    for (int j = 0; j < nSecSiz; j++)
    {
      int ny;
      cin >> ny;
      rvvnAdjcy[nx][ny] = 1;
    }
  }
}

void fnResult(const vector<vector<int>>& cnrvvnAdjcy)
{
  for (int i = 1; i < cnrvvnAdjcy.size(); i++)
  {
    for (int j = 1; j < cnrvvnAdjcy[i].size(); j++)
    {
      if (j != 1) cout << " ";
      cout << cnrvvnAdjcy[i][j];
    }
    cout << endl;
  }
}

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  vector<vector<int>> vvnAdjcy;

  fnInput(vvnAdjcy);
  fnResult(vvnAdjcy);

  return 0;
}

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

int main(){
	int n,m,l,i,j,p;
	cin >> n;
	int f[1000][1000];
	for ( i = 0; i < n; i++){
		cin >> m;
		cin >> p;
		for ( j = 0; j < p; j++){
			cin >> l;
			f[m-1][l-1] = 1;
		}
	}
	for ( i = 0; i < n; i++){
		for ( j = 0; j < n-1; j++){
			cout << f[i][j] << " ";
		}
		cout << f[i][n-1] << endl;
	}
}

C++: #include<iostream>
#include<cstdio>
#include<algorithm>

#define MAX 100
using namespace std;


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

C++: #include <stdio.h>
#include <vector>
using namespace std;
int main(){
    int cases;
    scanf("%d",&cases);
    for(int i=0;i<cases;i++){
        int times;
        scanf("%*d%d",&times);
        vector<int>table;
        for(int k=0;k<times;k++){
            int num;
            scanf("%d",&num);
            table.push_back(num);
        }
        int tmp=0;
        for(int k=0;k<cases;k++){
            if(k!=0){
                printf(" ");
            }
            if(tmp<table.size() && table[tmp]==k+1){
                printf("1");
                tmp++;
            }else{
                printf("0");
            }
        }
        printf("\n");
    }
}

C++: #include <iostream>

using namespace std;

int main() {
	int n, id, k, v, matrix[100][100] = { 0 };
	cin >> n;

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

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

	return 0;
}

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


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

}

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;
  }
  cout << endl;
  return 0;
}

C++: #include <iostream>
using namespace std;
int main() {
    int num, num1, numb2, list1;
    cin >> num;
    int matrix[num][num] = {};
    for(int i = 0; i < num; i++) {
        cin >> num1 >> numb2;
        for(int i = 0 ; i < numb2; i++) {
            cin >> list1;
            matrix[num1 - 1][list1 - 1] = 1;
        }
    }
    for(int i = 0 ; i < num; i++) {
        for (int p = 0; p < num; p++) {
            if (p != num -1) {
                cout << matrix[i][p] << " ";
            } else cout<<matrix[i][p] << endl;
        }
    }
}

C++: #include "bits/stdc++.h"

#define REP(i,num) for(int i=0;i<(num);++i)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto& x:c){cout<<x<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

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

	int N=in();
	vector<vector<int>> M(N,vector<int>(N,0));
	REP(i,N){
		int v=in()-1,k=in();
		REP(j,k){
			M[v][in()-1] = 1;
		}
	}

	REP(i,N){
		REP(j,N-1){
			cout << M[i][j] << ' ';
		}
		out(M[i][N-1]);
	}
	return 0;
}

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;
}