Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

//util
var sc = bufio.NewScanner(os.Stdin)

func nextStr() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func printList(list []int) {
	n := len(list)
	buf := bufio.NewWriter(os.Stdout)
	for _, v := range list[0 : n-1] {
		buf.Write([]byte(fmt.Sprintf("%d ", v)))
	}
	buf.Write([]byte(fmt.Sprintf("%d\n", list[n-1])))
	buf.Flush()
}

func max(a, b int) int {
	if a > b {
		return a
	} else {
		return b
	}
}

func min(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}

//solve

const MAX = 100

var n int
var A [MAX + 1][MAX + 1]int

func main() {
	sc.Split(bufio.ScanWords)
	n = nextInt()
	for i := 0; i < n; i++ {
		u, k := nextInt(), nextInt()
		A[u-1][u-1] = 0

		//fmt.Println(u, k)
		if k > 0 {
			for j := 0; j < k; j++ {

				v := nextInt()
				A[u-1][v-1] = 1

			}
		}

	}

	for i := 0; i < n; i++ {
		printList(A[i][0:n])
	}

}

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

int v,A[100][100],u,k,w;


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

C++: #include<iostream>
#define N 101
using namespace std;
int A[N][N];
int n;
int main(){
    int k,num;
    int e;
    cin>>n;
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++)
            A[i][j]=0;
    }
    for(int i=0;i<n;i++){
        cin>>k;
        k--;
        cin>>num;
        for(int j=0;j<num;j++){
            cin>>e;
            e--;
            A[k][e]=1;
        }
    }
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            if(j) cout<<' ';
            cout<<A[i][j];
        }
        cout<<endl;
    }
}

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

int main() {
	int n,graph[100][100];
	cin >> n;

	for (int i = 0; i < n; i++) {
		int vertex,jisu;
		cin >> vertex>>jisu;
		vertex--;
		for (int j = 0; j < jisu; j++) {
			int to;
			cin >> to;
			to--;
			graph[vertex][to] = 1;
		}
	}

	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			if (graph[i][j] != 1) graph[i][j] = 0;
			cout << graph[i][j];
			if (j < n - 1)cout << " ";
		}
		cout << "\n";
	}

	return 0;
}

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

int main(void){
    int n,u,k,i,j,x;
    bool path[110][110];
    memset(path,0,sizeof(path));
    cin>>n;
    for(i=0;i<n;i++){
        cin>>u>>k;
        u--;
        for(j=0;j<k;j++){
            cin>>x;
            x--;
            path[u][x]=true;
        }
    }
    
    for(i=0;i<n;i++){
        for(j=0;j<n-1;j++){
            cout<<path[i][j]<<" ";
        }
        cout<<path[i][n-1]<<endl;
    }
    
    return 0;
}

C++: #include <iostream>

using namespace std;

int main()
{
    int n, u, k, v, adj[110][110]={0};
    cin>>n;
    for (int i=0; i<n; i++)
    {
        cin>>u>>k;
        for (int j=0; j<k; j++)
        {
            cin>>v;
            adj[u][v]=1;
        }
    }
    for (int i=1; i<=n; i++)
    {
        for (int j=1; j<=n; j++)
        {
            if (j!=n) cout<<adj[i][j]<<' ';
            else cout<<adj[i][j]<<'\n';
        }
    }
    return 0;
}

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

void fnInput(vector<vector<int>> &rvvnAdjcy)
{
  int nMaxSiz;
  cin >> nMaxSiz;

  rvvnAdjcy.resize(nMaxSiz + 1, vector<int>(nMaxSiz + 1, 0));
  for (int i = 0; i < nMaxSiz; i++)
  {
    int nx, nSecSiz;
    cin >> nx >> nSecSiz;
    for (int j = 0; j < nSecSiz; j++)
    {
      int ny;
      cin >> ny;
      rvvnAdjcy[nx][ny] = 1;
    }
  }
}

void fnResult(const vector<vector<int>> &cnrvvnAdjcy)
{
  for (int i = 1; i < cnrvvnAdjcy.size(); i++)
  {
    for (int j = 1; j < cnrvvnAdjcy[i].size(); j++)
    {
      if (j != 1) cout << " ";
      cout << cnrvvnAdjcy[i][j];
    }
    cout << endl;
  }
}

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  vector<vector<int>> vvnAdjcy;

  fnInput(vvnAdjcy);
  fnResult(vvnAdjcy);

  return 0;
}

C++: #include <stdio.h>
int main(){
  int n,k,V[100][100],adj[100][99],i,j;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    for(j=0;j<n;j++)V[i][j]=0;
  }
  for(i=0;i<n;i++){
    scanf("%d %d",&adj[i][0],&k);
    for(j=1;j<=k;j++){
      scanf("%d",&adj[i][j]);
      V[i][adj[i][j]-1]=1;
    }
  }
  
  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      printf("%d",V[i][j]);
      if(j!=n-1)printf(" ");
    }
    printf("\n");
  }
  return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < n; ++i)
ll dx[4] = { 0, 1, 0, -1 };
ll dy[4] = { 1, 0, -1, 0 };
const ll INF = 1 << 21;
const ll MOD = 1e9 + 7;

int graph[100][100];

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    memset(graph, 0, sizeof(graph));
    rep(i, n)
    {
        int u, k;
        cin >> u >> k;
        u--;
        rep(j, k)
        {
            int v;
            cin >> v;
            v--;
            graph[u][v] = 1;
        }
    }
    rep(i, n)
    {
        rep(j, n)
        {
            cout << graph[i][j];
            if (j != n-1) {
                cout << " ";
            }
        }
        cout << endl;
    }
    return 0;
}

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

using namespace std;

int main(void){

    int n, k;

    cin >> n;
    vector<vector<bool> > A(n, vector<bool>(n, false));
    for(int i = 0; i < n; i++){
        cin >> k >> k;
        for(int j = 0; j < k; j++){
            int input;
            cin >> input;
            A[i][input-1] = true;
        }
    }

    for(int i = 0; i < n; i++){
        for(int j = 0; j < n; j++){
            if(j != n-1) cout << A[i][j] << " ";
            else cout << A[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>

using namespace std;

int n,u,k,v;
int a[101][101]={};

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

C++: #include <cstdio>
#define REP0(i,n) for(int i=0;i<n;i++)
using namespace std;
int main(){
  int n,a,b,x;
  int V[100][100]={0};
  scanf("%d",&n);
  REP0(i,n){
    scanf("%d %d",&a,&b);
    REP0(j,b){
      scanf("%d",&x);
      V[a-1][x-1]=1;
    }
  }
  REP0(i,n){
    REP0(j,n){
      if(j) printf(" ");
      printf("%d",V[i][j]);
    }
    printf("\n");
  }
  return 0;
}