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>
#define N 101

int main(){

  int u,k,i,j,v,n;
  int a[N][N];
  
  /*for(i=1;i<=N;i++){
    for(j=1;j<=N;j++){
      a[i][j]=0;
    }
  }
  */
  scanf("%d",&n);

  for(i=1;i<=n;i++){
    scanf("%d",&u);
    scanf("%d",&k);
    for(j=1;j<=k;j++){
      scanf("%d",&v);
      a[u][v]=1;
    }
  }
  
  for(i=1;i<=n;i++){
    for(j=1;j<n;j++){
      printf("%d ",a[i][j]);
    }
    printf("%d\n",a[i][n]);
  }

  return 0;

}

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

int main(){

  int n;

  cin >> n;

  int c[n][n];

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

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

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


using namespace std;


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


  vector< vector<int> > a;
  for(int i=0;i<n;i++){
    int u;
    int k;
    cin >> u >> k;
    vector<int> tmpa;
    for(int j=0;j<k;j++){
      int tmp;
      cin >> tmp;
      tmpa.push_back(tmp);
    }

    a.push_back(tmpa);
  }

  
  int a2[n][n]={0};  
  for(int i=0;i<n;i++){
    for(int j=0;j<(int)a[i].size();j++){
      a2[i][a[i][j]-1] = 1;
    }
  }

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

C++: #define _LIBCPP_DEBUG 0
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll MOD = 1e9 + 7;

vector<vector<int>> G(100+1,vector<int>(100+1,0));

int main(void) {

    int n; cin>>n;

    for (int i = 1; i <= n; ++i) {
        int u,k; cin>>u>>k;
        for (int j = 1; 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) {
            cout<<G[i][j];
            if(j!=n) cout<<" "; 
        }
        cout<<endl;
    }

    return 0;
}

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

int main()
{
 int i;
}

C++: #include <bits/stdc++.h>
using namespace std;
bool A[105][105];
int main()
{
	memset(A,0,sizeof(A));
	int n,v,u,du;
	cin>>n;
	getchar();
	for(int i=1;i<=n;i++){
		cin>>v>>du;
		while(du--)
			cin>>u,
			A[v][u] = 1;
	}
	for(int i=1;i<=n;i++){
		for(int j=1;j<=n;j++){
			if(j==1) cout<<A[i][j];
			else cout<<' '<<A[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;
int main(){
  int n;
  int v[100][100]={};
  int u,k,a;
  cin >> n;
  rep(i,n){
    cin >> u >> k;
    u--;
    rep(j,k){
      cin >> a;
      a--;
      v[u][a]=1;
    }
  }
  rep(i,n){
    rep(j,n){
      if(j>0) cout << " " << v[i][j];
      else cout << v[i][j];
    }
    cout << endl;
  }
  return 0;
}

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

#define rep(i,s,n) for(ll i = (s); i < (n); i++)
#define rep0(i,n) rep(i,0,n)
#define rep1(i,n) rep(i,1,n+1)

#define BR "\n"
#define SP " "

int main() {

  int N;
  cin >> N;

  vector<vector<ll>> G(N, vector<ll>(N, 0));

  rep0(i, N) {
    int u, k;
    cin >> u >> k;
    rep0(j, k) {
      int v;
      cin >> v;
      G[i][v - 1] = 1;
    }
  }

  rep0(i, N) {
    rep0(j, N - 1) {
      cout << G[i][j] << SP;
    }
    cout << G[i][N - 1] << BR;
  }
  return 0;
}

C++: #include <iostream>
using namespace std;
typedef long long ll;
#define int ll

int g[105][105];

signed main(void) {
  int n, u, k, v;

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

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

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

using namespace std;

struct Edge{
	int to;
};

vector<vector<int>> List_to_Mat(vector<vector<Edge>>& G){
	int V = G.size();
	vector<vector<int>> result;
	result = vector<vector<int>>(V, vector<int>(V, 0));

	for(int i = 0; i < V; i++){
		for(int j = 0; j < G[i].size(); j++){
			int v = G[i][j].to;
			result[i][v - 1] += 1;
		}
	}
	return result;
}


int main(void)
{
	int V;
	cin >> V;

	vector<vector<Edge>> AdjList(V);
	for(int i = 0; i < V; i++){
		int u, k;
		cin >> u >> k;
		for(int j = 0; j < k; j++){
			int v;
			cin >> v;
			AdjList[i].push_back(Edge{v});	
		}
	}

	vector<vector<int>> AdjMat = List_to_Mat(AdjList);
	for(int i = 0; i < V; i++){
		for(int j = 0; j < V; j++){
			if(j != V - 1)
				cout << AdjMat[i][j] << " ";
			else
				cout << AdjMat[i][j] << endl;
		}
	}
	return 0;
}

C++: #define _USE_MATH_DEFINES
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <clocale>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;

#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i, s, n) for(int i = (s), i##_len=(n); i < i##_len; ++i)
#define FORS(i, s, n) for(int i = (s), i##_len=(n); i <= i##_len; ++i)
#define VFOR(i, s, n) for(int i = (s); i < (n); ++i)
#define VFORS(i, s, n) for(int i = (s); i <= (n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define REPS(i, n) FORS(i, 0, n)
#define VREP(i, n) VFOR(i, 0, n)
#define VREPS(i, n) VFORS(i, 0, n)
#define RFOR(i, s, n) for(int i = (s), i##_len=(n); i >= i##_len; --i)
#define RFORS(i, s, n) for(int i = (s), i##_len=(n); i > i##_len; --i)
#define RREP(i, n) RFOR(i, n, 0)
#define RREPS(i, n) RFORS(i, n, 0)
#define ALL(v) (v).begin(), (v).end()
#define SORT(v) sort(ALL(v))
#define RSORT(v) sort(ALL(v), greater<decltype(v[0])>())
#define SZ(x) ((int)(x).size())
#define PB push_back
#define MP make_pair
#define MT make_tuple
#define BIT(n) (1LL<<(n))
#define UNIQUE(v) v.erase(unique(ALL(v)), v.end())

using ll = long long;
using Pi_i = pair<int, int>;
using VB = vector<bool>;
using VC = vector<char>;
using VD = vector<double>;
using VI = vector<int>;
using VLL = vector<ll>;
using VS = vector<string>;
using VSH = vector<short>;

const int MOD = 1000000007;
const int INF = 1000000000;
const int NIL = -1;

template<class T, class S>
bool chmax(T &a, const S &b){
    if(a < b){
        a = b; return true;
    }
    return false;
}
template<class T, class S>
bool chmin(T &a, const S &b){
    if(b < a){
        a = b; return true;
    }
    return false;
}



int main(){
    int n; cin >> n;
    vector<VI> A(n, VI(n, 0));
    REP(i, n){
        int u; cin >> u; --u;
        int k; cin >> k;
        REP(j, k){
            int v; cin >> v; --v;
            ++A[u][v];
        }
    }
    REP(i, n){
        REP(j, n){
            cout << (j ? " ": "") << A[i][j];
        }
        cout << "\n";
    }
    return 0;
}