Go: package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scan(&n)
	g := make([][]int, n)
	for i := 0; i < n; i++ {
		g[i] = make([]int, n)
	}

	for i := 0; i < n; i++ {
		var u,k int
		fmt.Scan(&u)
		fmt.Scan(&k)
		for j := 0; j < k; j++ {
			var v int
			fmt.Scan(&v)
			g[u-1][v-1] = 1
		}
	}

	for i := 0; i < n; i++ {
		fmt.Print(g[i][0])
		for j := 1; j < n; j++ {
			fmt.Printf(" %d", g[i][j])
		}
		fmt.Println()
	}
}

C++: #include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define rep2(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long Int;
typedef pair<Int, Int> P;
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;


int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    vector<vector<int>> edge(110);
    int n; cin>>n;
    for(int i=0; i<n; i++)
    {
        int u; cin>>u;
        u--;
        int k; cin>>k;
        if(k!=0) {
        for(int j=0; j<k; j++){
            int v; cin>>v;
            v--;
            edge[u].push_back(v);
        }
    }
    }
    for(int i=0; i<n; i++){
        vector<int> ans(n,0);
        for(int j=0; j<edge[i].size(); j++){
            ans[edge[i][j]]++;
        }
        for(int k=0; k<n; k++){
            cout<<ans[k]<<(k==n-1?'\n':' ');
        }
    }
    return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
int main(){
    int n,k,u,d;
    cin>>n;
    vector<vector<int> > Adj(n,vector<int>(n,0));
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            Adj[i][j]=0;
        }
    }
    for(int i=0;i<n;i++){
        cin>>k>>u;
        for(int j=0;j<u;j++){
            cin>>d;
            Adj[k-1][d-1]=1;
        }
    }
    
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            cout<<Adj[i][j]<<" ";
        }
        cout<<"\n"<<endl;
    }
    
    return 0;
}

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

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

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

	return 0;
}

C++: 
#include<iostream>

using namespace std;
static const int N=100;
int main(){
    int n,u,k,v;
    
    int M[N][N];
    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 <string>
using namespace std;

int main(int argc, char* argv[]) {
    int n, u, k, v;
    cin >> n;
    int G[n][n];

    for (int i = 0; i < n; i++){
        for (int j = 0; j < n; j++){
            G[i][j] = 0;
        }
    }

    for (int i = 0; i < n; i++){
        cin >> u >> k;
        for (int j = 0; j < k; j++){
            cin >> v;
            G[i][v-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<bits/stdc++.h>
using namespace std;
int main(void){
	int n;
	array<array<int,101>,101>arr;
	int u,k,v;
	int i,j;
	
	cin>>n;
	for(i=1;i<=n;i++){
		for(j=1;j<=n;j++){
			arr[i][j]=0;
		}
	}
	
	for(i=0;i<n;i++){
		cin>>u>>k;
		for(j=0;j<k;j++){
			cin>>v;
			arr[u][v]=1;
		}
	}
	for(i=1;i<=n;i++){
		cout<<arr[i][1];
		for(j=2;j<=n;j++){
			cout<<" "<<arr[i][j];
		}
		cout<<endl;
	}
	return 0;
}

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

int main (){
    int M[N][N] = {0};
    int n,u,k,v;
    cin >> n;

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

    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++: //16D8103012G 三品海渡
#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[j][i]==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 <iostream>
#include <string>
#include <map>
#include <set>
#include <algorithm>
using namespace std;
#define MAX 100000

int main(){
  int n;
  cin >>n;
  int A[n+2][n+2]={0};
  int t,k,l;
  for(int i=1;i<=n;i++){
    cin >> t >> k;
    for(int j=1;j<=k;j++){
      cin >> l;
      A[i][l]=1;
    }
  }
  for(int i=1;i<=n;i++){
    for(int j=1;j<=n;j++){
      if(j) cout << " ";
      cout << A[i][j];
    }
    cout << endl;
  }
  return 0;
}

C++: #include<iostream>
#include<cstdio>
#include<cstdlib>
#include<string.h>

using namespace std;


int main(){

  int n;
  cin >> n;
  int m[n][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++){
    int id, k, x;
    cin >> id >> k;
    for(int j = 0; j < k; j++){
      cin >> x;
      m[i][x - 1] = 1;
    }
  }

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

  return 0;
}

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"); }
    }
}