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 <stdio.h>

int map_max;
int map[110][110];
int rows;
int cols[110];
int mat[110][110];

void get_map();
void print_map();
void conv_map();
void print_mat();

int main()
{

  get_map();
  //print_map();
  conv_map();
  print_mat();
  return 0;
}

void get_map()
{

  int k;
  scanf("%d", &map_max);//<100

  for(int i=0;i<map_max;i++)
    {
      scanf("%d", &k);
      scanf("%d", &cols[i]);
      for(int j=0;j<cols[i];j++)
	{
	  map[i-1][j-1]=0;
	  scanf("%d", &map[i-1][j-1]);
	}
    }

  
  return ;
}

void print_map()
{
  for(int i=0;i<map_max;i++)
    {
      for(int j=0;j<cols[i];j++)
	{
	  printf("%d", map[i-1][j-1]);
	}
      puts("");
    }
return ;
}


void conv_map()
{
  for(int i=0;i<map_max;i++)
    {
      for(int j=0;j<cols[i];j++)
	{
	  mat[i][map[i-1][j-1]-1]=1;
	}
    }
  return ;
}

void print_mat()
{
  for(int i=0;i<map_max;i++)
    {
      for(int j=0;j<map_max;j++)
	{
	  printf("%d", mat[i][j]);
	}
      puts("");
    }
}

C++: #include <stdio.h>

int  main(){
  int i, j, k, n, x, y;
  int ans[101][101];
  
  scanf("%d", &n);
  
  for(i=0; i<n; i++){
    for(j=0; j<n; j++)
      ans[i][j] = 0;
  }
  
  for(i=0; i<n; i++){
    scanf("%d %d", &x, &y);
    for(j=0; j<y; j++){
      scanf("%d", &k);
      ans[i][k-1] = 1;
    }
  }
  
  for(i=0; i<n; i++){
    for(j=0; j<n; j++){
      if(j>0)
        printf(" ");
      printf("%d", ans[i][j]);
    }
    printf("\n");
  }
  
  return 0;
}

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

int main(){
  int n;
  int g[101][101];
  fill(g[0],g[101],0);
  cin >> 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++){
    cout << g[i][1];
    for(int j = 2;j <= n;j++){
      cout << ' ' << g[i][j];
    }
    cout << endl;
  }
}

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

int result[NUM][NUM];

int main()
{
    int n;
    cin >> n;
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < n; j++)
        {
            result[i][j] = 0;
        }
    }

    for (int i = 0; i < n; i++)
    {
        int u, k;
        cin >> u >> k;
        for (int j = 0; j < k; j++)
        {
            int tmp;
            cin >> tmp;
            result[u - 1][tmp - 1] = 1;
        }
    }

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

    return 0;
}

C++: #include <iostream>

using namespace std;

int main()
{
    int n, u, k, v;
    cin >> n;

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

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

    return 0;
}

C++: #include <bits/stdc++.h>
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;
  }
}

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


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

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

using namespace std;

vector<vector<int> > list_to_mat(vector<vector<int> >& adj){

  const int mat_size = (int)adj.size();
  vector<vector<int> > ans(mat_size,vector<int>(mat_size,0));
  for(int i=0; i<mat_size; i++){
    for(int j=0; j<adj[i].size(); j++){
      ans[i][adj[i][j]-1] = 1;
    }
  }
  return ans;
}

void dump_mat( vector<vector<int> > mat){
  
  const int mat_size = (int)mat.size();
  for(int i=0; i<mat_size; i++){
    for(int j=0; j<mat[i].size(); j++){
      cout << mat[i][j];
      if(j!=mat[i].size()-1)
	cout << " ";
      else
	cout << "\n";
    }
  }

}

int main(){
  int n; cin >> n;

  vector<vector<int> > list;
  for(int i=1; i<=n; i++){
    int u,k; cin >> u >> k;
    vector<int> tmp(k);
    for(int j=0; j<k; j++) cin >> tmp[j];
    list.push_back(tmp);
  }
  vector<vector<int> > mat = list_to_mat(list);
  dump_mat(mat);
}

C++: #include<bits/stdc++.h>
const long long INF = INT_MAX / 2;
const long long MOD = 1000000007;
const long double PI = 3.1415926;
#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--)
#define REP(i,n) FOR(i,0,n)
#define REP1(i,n) FOR(i,1,n+1)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(x) x.begin(),x.end()
#define RALL(x) x.rbegin(),x.rend()
#define ll long long int
using namespace std;
ll ans = 0, sum = 0, n, k, cnt = 0, w, h;
string s;
vector<ll> v;
vector < pair<ll, ll > > vp;
vector<vector<ll> > vv(50, vector<ll>(50, INF));
vector<string> vs;
vector<char> vc;
set<ll> st;
map<char, ll> mp;

/*--------------------template--------------------*/

int main()
{
	cin >> n;
	ll d[100][100];
	REP(i, n) REP(j, n) d[i][j] = 0;
	REP(i,n)
	{
		cin >> w >> k;
		REP(j, k) {
			cin >> h;
			d[i][h - 1] = 1;
		}
	}
	
	REP(i, n) {
		REP(j, n)
		{
			if (j) cout << ' ';
			cout << d[i][j];
		}
		cout << endl;
	}
}

C++: #include<iostream>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REP(j, n) for(int j = 0;j < n;j++)
using namespace std;

int main()
{
	int i,n,u;
	int v[100][100];
	cin >> n;
	REP(i,n){
		cin >> u;
		cin >> k;
		REP(i,k){
			cin >>v[i][k];
		}
	}
	REP(i,n){
		REP(j,n){
			cout << v[i][j] << " ";
		}
		cout<<endl;
	}
}

C++: #include <iostream>

#define MAX 100

using namespace std;

int adjacencyList[MAX + 1][MAX + 1];

int main(void)
{

	int n;
	int u;
	int k;
	int v;

	cin >> n;

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

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

	}

	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= n; j++) {
			if (j > 1) {
				putchar(' ');
			}
			
			printf("%d",adjacencyList[i][j]);
		}

		putchar('\n');

	}


	return 0;
}

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

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