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