Go: package main

import "fmt"

func main() {
	var N int
	fmt.Scan(&N)
	graph := make([][]int, N)
	for i := range graph {
		graph[i] = make([]int, N)
		var u, k int
		fmt.Scan(&u, &k)
		for j := 0; j < k; j++ {
			var v int
			fmt.Scan(&v)
			v--
			graph[i][v] = 1
		}
	}
	for i := 0; i < N; i++ {
		for j := 0; j < N; j++ {
			if j > 0 {
				fmt.Print(" ")
			}
			fmt.Print(graph[i][j])
		}
		fmt.Println()
	}
}

C++: #include <iostream>
#include <vector>
using namespace std;
typedef vector<int> vint;
#define range(i,a,b) for(int i=a;i<b;++i)
#define rep(i,n) range(i,0,n)

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

C++: #include<iostream>
#include<vector>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<vector<int>> ln(n, vector<int>(n+1, 0));
  vector<vector<int>> m(n,vector<int>(n,0));
  vector<int> rem(n, 0);
  for (int i = 0; i < n; i++)
    {
      cin >> ln[i][0];
      cin >> ln[i][1];
      for (int j = 2; j < ln[i][1]+2; j++)
	{
	  cin >> ln[i][j];
	}
    }
  for (int i = 0; i < n; i++)
    {
      for (int j = 2; j < n; j++)
	{
	  if (ln[i][j] != 0 )
	    {
	      m[i][ln[i][j]-1] = 1;
	    }
	}
    }
  for (int i = 0; i < n; i++)
    {
      for (int j = 0; j < n; j++)
	{
	  cout << m[i][j] << " ";
	}
      cout << endl;
    }
  return 0;
}

C++: #include<cstdio>
#include<iostream>
using namespace std;
int H[110][110];
int main()
{
    int n,m,a,b;
    scanf("%d",&n);
    for(int i=0;i<n;i++)
    {
        scanf("%d",&m);
        scanf("%d",&a);
        for(int i=0;i<a;i++)
        {
            scanf("%d",&b);
            H[m][b]++;
        }
    }
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=n;j++)
        printf("%d ",H[i][j]);
        printf("\n");
    }
    return 0;
}

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

int ari;
int jiku[102];
int u[102];
int v[102][102];
int ushi[102][102];
int main(){
  cin>>ari;
  for(int i=1;i<ari+1;i++){
    cin>>u[i];
    cin>>jiku[u[i]];
      for(int j=1;j<jiku[u[i]]+1;j++){
	cin>>v[u[i]][j];
      }
  }
  for(int k=1;k<ari+1;k++){
  //	cout << jiku[k] << endl;
    for(int l=1;l<jiku[k]+1;l++){
    //	cout << k << " " << l << endl;
      for(int m=1;m<ari+1;m++){
		//cout<<v[k][l];
	if(v[k][l]==u[m]){ushi[k][m]=1;}
	//	cout<<ushi[k][m];
      }
    }
  }
    for(int k=1;k<ari+1;k++){
      for(int m=1;m<ari;m++){
	cout<<ushi[k][m]<<" ";
      }cout<<ushi[k][ari];
      cout<<endl;}
}

C++: #include <bits/stdc++.h>

using namespace std;

typedef long long ll;

const int INF = 1e9;

int main()
{
  int n = 0;
  fscanf(stdin, "%d", &n);
  vector<vector<int> > mat(n, vector<int>(n, 0));
  for (int i = 0; i < n; ++i) {
    int u = -1, k = -1, v = -1;
    fscanf(stdin, "%d %d", &u, &k);
    for (int j = 0; j < k; ++j) {
      fscanf(stdin, "%d", &v);
      mat[u - 1][v - 1] = 1;
    }
  }
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < n; ++j) {
      if (j) { fprintf(stdout, " "); }
      fprintf(stdout, "%d", mat[i][j]);
    }
    fprintf(stdout, "\n");
  }
  return 0;
}

C++: #include<iostream>

using namespace std;
 
int main()
{
  int g[100][100];
  int n;
  
  for(int i=0; i<100; i++)
    {
      for(int j=0; j<100; j++)
	{
	  g[i][j]=0;
        }
    }
  
  cin>>n;

  int x,y,z;
    
  for(int i=0; i<n; i++)
    {
      cin>>x>>y;
      for(int j=0; j<y; j++)
	{
	  cin>>z;
	  g[x-1][z-1]=1;
        }
    }
  
  for(int i=0; i<n; i++)
    {
      for(int j=0; j<n; j++)
	{
	  if(j!=0) cout<<" ";
	  cout<<g[i][j];
        }
      cout<<'\n';
    }
    return 0;
}

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

int main()
{
    int n,u,v,d;
    int G[101][101];
    cin>>n;
    for(int i=1;i<=n;i++)
        for(int j=1;j<=n;j++)
            G[i][j]=0;
    for(int i=0;i<n;i++)
    {
        cin>>u>>d;
        for(int k=0;k<d;k++)
        {
            cin>>v;
            G[u][v]=1;
            //cout<<u<<' '<<v<<' '<<G[u][v]<<endl;
        }
    }
    for(int i=1;i<=n;i++)
    {
        int isn=0;
        for(int j=1;j<=n;j++)
        {
            if(isn++>0)cout<<' ';
            cout<<G[i][j];
        }
        cout<<endl;
    }
    return 0;
}

C++: #include <iostream>
using namespace std;
int adj[100][100] = {0};
int main()
{
	int n;
	cin >> n;
	for (int i=0;i<n;i++) {
		int j, k;
		cin >> j >> k;
		j--;
		for (int m=0;m<k;m++) {
			int a;
			cin >> a;
			a--;
			adj[j][a]=1;
		}
	}

	for (int i=0;i<n;i++) {
		for (int j=0;j<n;j++) {
			cout << adj[i][j];
			if (j<n) cout << ' ';
		}
		cout << endl;
	}
		
	return 0;
}

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

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

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

int main() {
	
	int i, j, n, u, k, v, maxu, a[102][102] = {};
	
	cin >> n;
	maxu = 0;
	for (i = 0; i < n; i++) {
		cin >> u >> k;
		for (j = 0; j < k; j++) {
			cin >> v;
			a[u][v] = 1;
			maxu = max(maxu, u);
		}
	}

	for (i = 1; i <= maxu; i++) {
		for (j = 1; j <= maxu; j++) {
			cout << " " << a[i][j];
		}
		cout << endl;
	}
}

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

static const int N=100;

int main()
{
    int M[100][100];
    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 <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using P = pair<int, int>;
typedef long long ll;


int main() {
  int n;
  cin >> n;
  int m[n][n];
  rep(i, n){
    rep(j,n){
      m[i][j] = 0;
    }
  }
  rep(i,n){
    int u, k;
    cin >> u >> k;
    u--;
    rep(j,k){
      int v;
      cin >> v;
      v--;
      m[u][v] = 1;
    }
  }
  rep(i,n){
    rep(j,n){
      cout << m[i][j] << (j == n - 1 ? "\n" : " ");
    }
  }
}

C++: #include<iostream>
#include<map>
#include<vector>
#include<algorithm>
#include<cmath>
#include<climits>
#include<ctime>
#include<cstring>
#include<stack>
#include<queue>
#include<sstream>
#include<string>
#include<set>
#include<array>
#include<cassert>

#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define DUMP(list) cout << "{ "; for(auto nth : list){ cout << nth << " "; } cout << "}" << endl
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i);

using namespace std;

int main(){
	
	int n;
	cin >> n;
	vector<vector<int>> ans(n,vector<int>(4,0));

	rep(i,n){
		int u,k;
		cin >> u >> k;	
		u--;
		rep(j,k){
			int v;
			cin >> v;
			v--;
			ans[u][v]=1;
		}
	}

	cout << "test" << endl;

	rep(i,n){
		rep(j,n-1){
			cout << ans[i][j] << " ";	
		}
		cout << ans[i][n-1] << endl;
	}

	return 0;
}