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 <iostream>
#include <vector>
#include <cassert>
#include <algorithm>
#include <functional>

using namespace std;
    
#include <iostream>
#include <vector>
#include <cassert>
#include <algorithm>
#include <functional>
#include <cmath>
#include <iomanip>
#include <limits>
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin >> n;
    vector<vector<int>> vec(n);
    vector<int> SIZE;
    for(int i=0;i<n;i++){
        int x;
        cin >> x;
        int num;
        cin >> num;
        SIZE.push_back(num);
        for(int j = 0;j< num;j++){
            int y;
            cin >> y;
            vec[x-1].push_back(y-1) ;
        }
    }
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            bool hantei=0;
            for(int k=0;k<SIZE[i];k++){
                if(vec[i][k]==j) {cout << 1 <<" "; hantei=1;}
            }
            if(hantei==0) cout <<0<<" ";
        }cout << endl;
    }cout << endl;
}

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

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

int main(){
	int n,m,l,i,j,p;
	cin >> n;
	int f[101][101];
	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>
using namespace std;
static const int N = 100;

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

    std::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++) {
        std::cin >> u >> k;
        u--;
        for (int j = 0; j < k; j++) {
            std::cin >> v;
            v--;
            M[u][v] = 1;
        }
    }

    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            if(j) std::cout << " ";
            std::cout << M[i][j];
        }
        std::cout << std::endl;
    }

    return 0;
}

C++: #include <iostream>

using namespace std;
static const int N = 100;

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

	std::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)
	{
		std::cin >> u >> k;
		u--;

		for(int j = 0; j < k; ++j)
		{
			std::cin >> v;
		    v--;
			M[u][v] = 1;	
		}
	}

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

	return 0;
}

C++: #include<iostream>

using namespace std;

int main(){
    int A[150][150];
    int n1,n2,a,b;
    cin >> n1;
    for (int i = 0; i < n1; i++){
        cin >> a;
        cin >> n2;
        for (int j = 0; j < n2; j++){
            cin >> b;
            A[a-1][b-1] = 1;
        }
    }
    for (int i = 0; i < n1; i++){
        for (int j = 0; j < n1; j++){
            cout << A[i][j];
            if (j == n1 - 1){
                cout << endl;
            }
            else {
                cout << " ";
            }
        }
    }
}

C++: #include<stdio.h>
#include<stdlib.h>

#pragma warning (disable:4996)

int main() {
	int a1[150][150] = { 0 };
	int a = 0,b=0,c=0,d=0;
	scanf("%d", &a);
	
	for (int i = 0; i < a; i++) {
		scanf("%d", &b);
		scanf("%d", &c);
		if (c > 0) {
			for (int j = 0; j < c; j++) {
				scanf("%d", &d);
				a1[b - 1][d - 1] = 1;
			}
		}
		if (c == 0) {
			for (int q = 2; q < a; q++) {
				a1[i][q] = 0;
			}
		}
	}
	for (int i = 0; i < a; i++) {
		for (int j = 0; j < a; j++) {
			printf("%d ", a1[i][j]);
		}
		printf("\n");
	}

	return 0;
}

C++: #include <stdio.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <math.h>
#include <string>
#include <string.h>
#include <queue>
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
int N,W;
int vx[]={1,0,-1,0};
int vy[]={0,1,0,-1};
int mt[102][102];
using namespace std;
void solve(){
    cin >> N ;
    int E,K;
    memset (mt,0,102*102);
    REP(i,N){
      cin >> E >> K;
      REP(j,K)
      {
        cin >> E;
        mt[i][E-1] = 1 ;
      }
    }
    REP(x,N){
      REP(y,N){
        cout << mt[x][y] << " ";
      }
      cout << endl;
    }
}
int main(){

    solve();
}

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; i<n; j++)
      m[i][j]=0;
  }

  for(int i=0; i<n; i++)
  {
    cin >> u >> k;
    u--;
    for(int j=0; i<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 << endl;
  }

  return 0;
}

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

int main(){
  int n, u, k, v;
  cin >> n;
  int A[n * n];

  for(int i = 0; i < n * n; i++)
    A[i] = 0;

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

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

C++: #include "bits/stdc++.h"
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vll = vector<vector<ll>>;
using pii = pair<int,int>;
#define FOR(i,a,b) for(ll i = (a); i < (b); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(obj) (obj).begin(), (obj).end()
#define pb push_back
const double PI = acos(-1);
const double EPS = 1e-10;
const ll MOD = 1000000007;
void cioacc(){//accelerate cin/cout
  cin.tie(0);
  ios::sync_with_stdio(false);
}
int main(){
  int n;
  cin >> n;
  vvi graph(n,vi(n,0));
  REP(i,n){
    int k;
    cin >> k >> k;
    REP(j,k){
      int tmp;
      cin >> tmp;
      graph[i][tmp-1]++;
    }
  }
  REP(i,n){
    cout << graph[i][0];
    FOR(j,1,n){
      cout << " " << graph[i][j];
    }
    cout << endl;
  }
}