Go: package main

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

const N = 100

func answer(reader io.Reader) string {
	sc := bufio.NewScanner(reader)
	sc.Split(bufio.ScanWords)

	sc.Scan()
	n, _ := strconv.Atoi(sc.Text())

	var M [N][N]int
	for i := 0; i < n; i++ {
		sc.Scan()
		u, _ := strconv.Atoi(sc.Text())
		sc.Scan()
		k, _ := strconv.Atoi(sc.Text())
		u--
		for j := 0; j < k; j++ {
			sc.Scan()
			v, _ := strconv.Atoi(sc.Text())
			v--
			M[u][v] = 1
		}
	}

	var out bytes.Buffer
	for i := 0; i < n; i++ {
		for j := 0; j < n; j++ {
			if j != 0 {
				out.WriteString(" ")
			}
			out.WriteString(fmt.Sprintf("%d", M[i][j]))
		}
		out.WriteString("\n")
	}

	return strings.TrimRight(out.String(), "\n")
}

func main() {
	fmt.Println(answer(os.Stdin))
}

C++: #include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
#include <stack>
#include <functional>
#include <queue>
#include <cmath>
#include <set>
#include <map>
#include <numeric>

#define rep(i,j,k) for(int i=(int)j;i<(int)k;i++)
#define Sort(x) sort((x).begin(),(x).end())
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define vi vector<int>
#define INF (int)1e9
#define INFL 1e18
#define MOD 1000000007
#define pb push_back
#define MP make_pair
typedef long long int ll;
typedef std::pair<int,int> P;
int D=1;
int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

using namespace std;

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

C++: // ALDS1_11_A: Graph
#include <iostream>
#include <vector>
#include <algorithm>
bool debug = false;

std::vector<std::vector<int>> graph;

int main() {
    int total; std::cin >> total;
    graph.resize(total);
    for (int i=0; i<graph.size(); i++) {
        graph.at(i).resize(total);
    }
    for (int i=0; i<graph.size(); i++) {
        for (int j=0; j<graph.at(i).size(); j++) {
            graph.at(i).at(j) = 0;
        }
    }
    
    int vertex, outdegree;
    for (int i=0; i<total; i++) {
        std::cin >> vertex >> outdegree;
        for (int j=0; j<outdegree; j++) {
            int adjacent_vertex;
            std::cin >> adjacent_vertex;
            graph.at(vertex-1).at(adjacent_vertex-1) = 1; 
        }
    }

    for (int i=0; i<graph.size(); i++) {
        for (int j=0; j<graph.at(i).size(); j++) {
            std::cout << graph.at(i).at(j) << (j==graph.at(i).size()-1 ? "\n" : " ");
        }
    }
}

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 a[100][100];
int n;
int main() {
	cin >> n;
	int p,q,r;
	for (int i=0; i<n; ++i) {
		int >> p >> q;
		for (int i=0; i<q; ++i) {
			cin >> r;
			a[p][r] = 1;
		}
	}
	for (int i=0; i<n; ++i) {
		for (int j=0; j<n-1; ++j) {
			cout << a[i+1][j+1] << " ";
		}
		cout << a[i+1][n] << 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;
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>
#include<vector>
#include<queue>
#include<stack>
#include<map>
#include<string>
#include<algorithm>
#include<utility>
#include<math.h>
using namespace std;
typedef long long int ll;
typedef pair<ll, int> P;
const int INF = pow(10, 8);
const ll LINF = ll(1e18);

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;u--;
    while(k--){
      int v;cin>>v;v--;
      ans[u][v]=1;
    }
  }
  for(int i=0;i<n;i++){
    for(int j=0;j<n;j++){
      if(j!=n-1)cout<<ans[i][j]<<" ";
      else cout<<ans[i][j]<<endl;
    }
  }
  return 0;
}

C++: #include<iostream>
using namespace std;
int a[105][105];

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

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

int main()
{
	int g[MAX][MAX] = { 0 };
	int n;
	cin >> n;
	for (int i = 0; i < n; i++) {
		int id, k;
		cin >> id >> k;
		for (int j = 0; j < k; j++) {
			int c;
			cin >> c;
			g[id - 1][c - 1] = 1;
		}
	}
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			cout << g[i][j];
			if (j < n - 1) {
				cout << " ";
			}
		}
		cout << endl;
	}
	return 0;
}

C++: #include <iostream>
#include <string>
#include <vector>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <functional>
#include <map>
#include <cmath>
#include <queue>

using namespace std;

int main() {


    int n;scanf("%d",&n);
    int u;
    int k;
    vector<vector<int> > graph;
    graph.resize(n);
    for(int i=0;i<n;i++){
        graph[i].resize(n);
    }
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            graph[i][j]=0;
        }
    }

    for(int i=0;i<n;i++){
        scanf("%d",&u);
        scanf("%d",&k);
        int value;
        for(int j=0;j<k;j++){
            scanf("%d",&value);
            graph[u-1][value-1]=1;
        }
    }

    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            printf("%d",graph[i][j]);
            if(j!=n-1){
                printf(" ");
            }
        }
        if(i!=n-1) {
            printf("\n");
        }
    }

    return 0;
}