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 <bits/stdc++.h>
using ll = long long;
using namespace std;
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for(int i = int(a); i < int(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
const long long INFLL = 1LL << 60;
const int INFINT = 1 << 30;
const long long MOD = 1e9 + 7;

template <class T> void vecout(T V) {
    auto t = V.begin();
    *t++;
    while(t != V.end()) {
        cout << " " << *t++;
        // if(t != V.end()) cout << " ";
    }
    cout << endl;
};
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, a, b, c;
    cin >> n;
    vector<vector<int>> G(n, vector<int>(n, 0));
    rep(i, n) {
        cin >> a >> b;
        rep(j, b) {
            cin >> c;
            G[a - 1][c - 1] = 1;
        }
    }
    rep(i, n) {
        rep(j, n) { cout << G[i][j] << (j + 1 != n ? " " : "\n"); }
    }
}

C++: //16D8104001K 田中誠人 makoto0106 c++
#include<iostream>
#include<vector>
#include<algorithm>
int main()
{
  std::vector<int>num;
  int n,k,tmp,x,size;

  std::cin>>n;
  
  for(int i=0;i<n;i++){
    std::cin>>tmp>>k;
    num.push_back(k);
    for(int j=0;j<k;j++){
      std::cin>>tmp;
      num.push_back(tmp);
      //std::cout<<tmp<<" ";
    }
  }
  size=num.size();
  /*
  for(int i=0;i<size;i++){
    std::cout<<num[i]<<" ";
  }
  */
  x=0;
  std::cout<<"\n";
  while(x<size){
    if(num[x]==0){
      for(int i=0;i<n;i++){
	std::cout<<"0 ";
      }
      x++;
    }else{
      x++;
      for(int i=0;i<n;i++){
      
	if(i+1==num[x]){
	  std::cout<<"1 ";
	  x++;
	}else{
	  std::cout<<"0 ";
	}
      }
    }
    std::cout<<"\n";
  }
  
  
  return 0;
}

C++: // http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_11_A
// Graph I - Graph

#define SUBMIT

#include <utility>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <vector>
#include <limits>
#include <numeric>
#include <functional>
#include <set>
#include <cmath>
#include <cstring>
#include <climits>
#include <memory>

using namespace std;
using ui64 = unsigned long long;
using i64 = long long;

const ui64 MAX_N = 100;
// dp[i][j] [i, j]までの行列をかけたときの最小コスト

int adj[MAX_N][MAX_N];

int main() {
    memset(adj, 0, sizeof(adj));

    int n;
    cin >> n;

    int u, degree;
    for (int i = 0; i < n; ++i) {
        cin >> u >> degree;
        u--; // 0-origin

        int v;
        for (int j = 0; j < degree; ++j) {
            cin >> v;
            v--; //0-origin
            adj[u][v] = 1;
        }
    }

    for (int y = 0; y < n; ++y) {
        for (int x = 0; x < n; ++x) {
            cout << adj[y][x];
            if (x != n -1) cout << " ";
            else cout << endl;
        }
    }

    return 0;
}

C++: #include <iostream>

int main(){
	int n,k,u,v;
	bool G[100][100] = {};
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		scanf("%d %d",&u,&k);
		for(int j=0;j<k;j++){
			scanf("%d",&v);
			G[u-1][v-1]=1;
		}
	}

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

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++)
    {
      scanf("%d", &map[i][j]);
    }
    }
 
   
  return ;
}
 
void print_map()
{
  for(int i=0;i<map_max;i++)
    {
      for(int j=0;j<cols[i];j++)
    {
      printf("%d", map[i][j]);
    }
      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][j]-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]);
      if(j!=map_max-1)
        {
          printf(" ");
        }
    }
    printf("\n");
    }
}

C++: //#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; ++i)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = int64_t;
using ld = long double;
using P = pair<int, int>;
using vs = vector<string>;
using vi = vector<int>;
using vvi = vector<vi>;
const int INF = 100010001;
const ll LINF = (ll)INF*INF*10;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    vvi G(n, vi(n));
    rep(i, n) {
        int oo;
        cin >> oo;
        int k;
        cin >> k;
        rep(i, k) {
            int s;
            cin >> s;
            G[oo-1][s-1] = 1;
        }
    }

    rep(i, n) {
        rep(j, n) {
            cout << G[i][j] << (j == n-1?'\n':' ');
        }
    }
}

C++: #include<iostream>
using namespace std;
static const int N = 120;

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 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<iostream>
#include<cstdio>
using namespace std;
int M[101][101];
int main(){
  int n,u,k,v;
  scanf("%d",&n);
  for(int i=0;i<n;i++){
    scanf("%d%d",&u,&k);
    u--;
    for(int j=0;j<k;j++){
      scanf("%d",&v);
      v--;
      M[u][v]=1;
    }
  }
  for(int i=0;i<n;i++){
    for(int j=0;j<n;j++){
      if(j) printf(" ");
      printf("%d",M[i][j]);
    }
    printf("\n");
  }
  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;
}