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>
using namespace std;
#define FOR(i,k,n) for(int i = (k); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define INF 114514810
#define MOD 1000000007
#define ALL(a) begin(a),end(a)
#define MS(m,v) memset(m,v,sizeof(m))
#define D10  fixed<<setprecision(10)
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> P;
typedef long long ll;
struct edge
{
	int from, to, cost;
	bool operator < (const edge& e) const { return cost < e.cost; }
	bool operator >(const edge& e) const { return cost > e.cost; }
};
///*************************************************************************************///
///*************************************************************************************///
///*************************************************************************************///

int main()
{
	int d[105][105];
	MS(d, 0);
	int n; cin >> n;
	REP(i, n)
	{
		int a, b; cin >> a >> b;
		a--;
		int to;
		REP(j, b)
		{
			cin >> to;
			to--;
			d[a][to] = 1;
		}
	}
	REP(i, n)
	{
		REP(j, n-1)
		{
			cout << d[i][j] << " ";
		}
		cout << d[i][n - 1] << endl;
	}
	return 0;
}

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

static const int N = 101;

using namespace std;

int main () {
  int V[N + 1][N + 1], n, v, v2, k;

  for (int i = 0; i <= N; i++)
    for (int j = 0; j <= N; j++)
      V[i][j] = 0;

  cin >> n;

  for (int i = 0; i < n; i++) {
    cin >> v >> k;

    for (int j = 0; j < k; j++) {
      cin >> v2;
      V[v][v2] = 1;
    }
  }

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

  return 0;
}

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

int m[101][101];

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

const static int N = 100;

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

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

  return 0;    
}

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

using namespace std;

static const int N = 100;

int main()
{
	int m[100][100];
	for (int i = 0; i < 100; ++i)
	{
		for (int j = 0; j < 100; ++j)
		{
			m[i][j] = 0;
		}
	}

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

	for (int i = 0; i < n; ++i)
	{
		for (int j = 0; j < n; ++j)
		{
			cout << m[i][j];
			if (j != n - 1) cout << " ";
		}
		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' : ' ');
    }
  }
}

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

int main() {
  int n;
  cin>>n;
  vector<vector<int>> ans(n, vector<int>(n, 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;
      ans[u-1][v-1]=1;
    }
  }
  for(int i=0;i<n;i++){
    for(int j=0;j<n;j++){
      cout<<ans[i][j];
      if(j!=n-1)cout<<' ';
    }
    cout<<endl;
  }
}

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

int A[101][101] = {0};

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

    for ( i = 1; i <= n; i++ ) {
        for ( j = 1; j <=n; j ++ ) {
                if ( j != 1 ) cout << ' ';
            cout << A[i][j];
        }
        cout << endl;
    }
}

C++: #include <iostream>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
const int INF = 1<<30; 
const int MOD = 1e9 + 7;
const int MAX_N = 150;
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    int G[MAX_N][MAX_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][v] = 1;
        }
    }
    for(int i = 1; i <= n; i++)
    {
        for(int j = 1; j <= n; j++) 
        {
            if(j == 1) cout << G[i][j];
            else cout << " " << G[i][j];
        }
        cout << endl;
    }
    return 0;
}

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

int main ()
{
    int N;
    cin >> 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++)
    {
        int u, k;
        cin >> u >> k;
        u--;

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

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

    return 0;
}

C++: #include<iostream>
#include<vector>
#include<cstdio>
using namespace std;
int judge(int i,int n,int variable,vector< vector<int> > &v)
{
  for(int j=0;j<v[variable].size();++j){
    if(i==v[variable][j]){
      return 1;
      break;
    }
  }
  return 0;
}
int main()
{
  int n,u,k,vv;
  cin>>n;
  vector< vector<int> > v(n),a(n,vector<int>(n));
  for(int variable=0;variable<n;++variable){
    cin>>u>>k;
    for(int i=0;i<k;++i){
      cin>>vv;
      v[variable].push_back(vv);
    }
  }
  for(int variable=0;variable<n;++variable)
    for(int i=1;i<=n;++i)
      a[variable][i-1]=judge(i,n,variable,v);
  for(int variable=0;variable<n;++variable){
    for(int i=0;i<n;++i){
        printf("%d%c", a[variable][i], i == n - 1 ? '\n' : ' ');
    }
  }
    return 0;
}