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<iostream>
using namespace std;

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

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

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

int main(){
  int n;
  cin >> n;
  int mat[n + 1][n + 1];

  for(auto i = 0; i < n + 1; i++){
    for(auto j = 0; j < n + 1; j++){
      mat[i][j] = 0;
    }
  }

  for(auto i = 1; i <= n; i++){
    int vertex, dimout;
    cin >> vertex >> dimout;

    vector<int> adjvertices(dimout);
    for(auto j = 0; j < dimout; j++){
      cin >> adjvertices[j];
      mat[vertex][adjvertices[j]] = 1;
    }
  }

  for(auto i = 1; i <= n; i++){
    for(auto j = 1; j <= n; j++){
      cout << mat[i][j];
      if(j != n) cout << " ";
    }
    cout << endl;
  }
}

C++: #include<iostream>
#include<math.h>
#include<string>
#include<vector>
#include<algorithm>
#include<queue>
using namespace std;
#define INF 1<<20

struct edge{
	int to;
	int cost;
	edge() {};
	edge(int a, int b) {
		to = a;
		cost = b;
	}
};

struct Node {
	int pos;
	int cost;
	Node() {};
	Node(int a, int b) {
		pos = a;
		cost = b;
	}
	bool operator <(const Node& rhs) const {
		return cost > rhs.cost;
	}
};

void dijkistra(int st, int TO,int V,vector<vector<edge> > graph) {
	priority_queue<Node> q;
	vector<int> d(V);
	for (int i = 0;i < V;i++) {
		d[i] = INF;
	}
	d[st] = 0;
	q.push(Node(st, 0));
	while (!q.empty()) {
		Node s = q.top(); q.pop();
		int pos = s.pos;
		for (int i = 0;i < graph[pos].size();i++) {
			int to = graph[pos][i].to;
			int cost = graph[pos][i].cost;
			if (d[pos] + cost < d[to]) {
				d[to] = d[pos] + cost;
				q.push(Node(to, d[to]));
			}

		}
	}
	cout << d[TO] << endl;
}
int partition(int A[],int p, int r) {
	int x = A[r];
	int i = p - 1;
	for (int j = p;j < r;j++) {
		if (x >= A[j]) {
			i = i + 1;
			swap(A[i], A[j]);
		}
	}
		swap(A[i + 1], A[r]);
		return i + 1;
}
void quicksort(int A[], int p, int r) {
	if (p < r) {
		int q = partition(A, p, r);
		quicksort(A, p, q-1);
		quicksort(A, q + 1, r);
	}
}

int getNumberOfCoin(int C[],int n,int m) {
	int T[50000];
	for (int j = 0;j <= n;j++) {
		T[j] = INF;
	}
	T[0] = 0;
	for (int i = 0;i < m;i++) {
		for (int j = 0;j <= n;j++) {
			if (j - C[i] >=0  ) {
				T[j] = min(T[j], T[j - C[i]] + 1);
			}
		}
	}
	return T[n];
}
int knapsack(int w, int n,int* v,int* ww) {
	int W[101][10001];
		for (int j = 0;j <= w;j++) {
			W[0][j] = 0;
		}
	for (int i = 0;i < n;i++) {
		for (int k = 0;k < n;k++){
			for (int j = 0;j <= w;j++) {
				if (j - ww[k] < 0) {
					W[i + 1][j] = W[i][j];
				}
				if (j - ww[i] >= 0) {
					W[i + 1][j] = max(W[i][j], W[i][j - ww[k]] + v[k]);

				}
			}
		}
	}
	return W[n][w];
}
int main() {
	int point;
	cin >> point;
	vector<queue<int> >lis(point);
	for (int i = 0;i < point;i++) {
		int V,edges;
		cin >> V>>edges;
		for (int j = 0;j < edges;j++) {
			int h;
			cin >> h;
			lis[i].push(h-1);
		}
	}

	vector<vector<int> > v(point, vector<int>(point, 0));
	for (int i = 0;i < point;i++) {
		while (!lis[i].empty()) {
			int j = lis[i].front();
			lis[i].pop();
			v[i][j] = 1;
		}
	}
	for (int i = 0;i < point;i++) {
		for (int j = 0;j < point;j++) {
			cout << v[i][j]<<" ";
		}
		cout << endl;
	}

	return 0;
	
}

int isPrime(int x) {
	if (x <= 1) return false;
	if (x>2 && x % 2 == 0) return false;
	for (int i = 2;i <= sqrt(x);i++) {
		if (x%i == 0) {
			return false;
		}
	}
	if (x == 2) return true;
	return true;
}

C++: #include <algorithm>
#include <iostream>
#include <string>
#include <cstring>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <iomanip>
#include <limits>
#include <map>
#include <queue>
#include <stack>
#include <vector>

#define FOR(i,k,n) for(int (i) = (k); (i) < (n); ++(i))
#define rep(i,n) FOR(i,0,n)
#define pb push_back
#define all(v) begin(v), end(v)
#define debug(x) cerr << #x << ": " << x << endl
#define debug2(x,y) cerr << #x << ": " << x << ", " << #y << ": " << y << endl

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<i_i, int> p_i;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
template<class T> using vv=vector<vector<T>>;
typedef deque<int> di;
typedef deque<deque<int>> ddi;


int main() {
    int n;
    bool g[101][101] = {};
    cin >> n;
    rep(i,n) {
        int u,k;
        cin  >> u >> k;
        rep(j,k) {
            int tmp;
            cin >> tmp;
            g[u][tmp] = 1;
        }
    }
    FOR(i,1,n+1) {
        FOR(j,1,n+1) {
            cout << g[i][j] << " ";
        }
        cout << endl;
    }
	return 0;
}

C++: 
#include <iostream>

using namespace std;

int a[110][110];

int main(){
    int N;
    cin >> N;
    for(int i = 0;i < N;i++){
        int n,k;
        cin >> n >> k;
        for(int j = 0;j < k;j++){
            int l;
            cin >> l;
            a[i][l-1] = 1;
        }
    }
    for(int i = 0;i < N;i++){
        for(int j = 0;j < N;j++){
            cout << a[i][j];
            if(j != N-1){
                cout << " ";
            }
        }
        cout << endl;
    }
}

C++: #include <iostream>
using namespace std;
int main() {
  int a[100][100] = {};
  int n, k, idx, v;
  cin >> n;
  for(int i = 0; i < n; ++i) {
	cin >> idx >> k;
	for(int j = 0; j < k; ++j) {
	  cin >> v;
	  a[i][v - 1] = 1;
	}
  }

  for(int i = 0; i < n; ++i) {
	for(int j = 0; j < n; ++j) {
	  cout << a[i][j];
	  cout << (j < n - 1 ? " " : "\n");
	}
  }
  return 0;
}

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

int main() {
  int n;
  cin>>n;
  vector<vector<int>>a(n,vector<int>(n,0));
  for(int i=0;i<n;i++){
    int num;
    cin>>num;
    num--;
    int m;
    cin>>m;
    for(int j=0;j<m;j++){
      int x;
      cin>>x;
      x--;
      a[num][x]++;
    }
  }
  for(int i=0;i<n;i++){
    for(int j=0;j<n;j++){
      cout<<a[i][j];
      if(j!=n-1)cout<<" ";
    }
    cout<<endl;
  }
  return 0;
}

C++: #include <stdio.h>
#include <iostream>
#include <algorithm>
#include <math.h>
#include <stack>

using namespace std;

int minimum=-1;


int main(){
	int n,row,num,col;
	scanf("%d",&n);
	int table[n][n];
	for(int i=0;i<n;i++){
		for(int k=0;k<n;k++){
			table[i][k] = 0;
		}
	}

	for(int i=0;i<n;i++){
		scanf("%d %d",&row,&num);
		for(int k=0;k<num;k++){
			scanf("%d",&col);
			table[row-1][col-1]=1;
		}
	}

	for(int i=0;i<n;i++){
		for(int k=0;k<n-1;k++){
			printf("%d ",table[i][k]);
		}
		printf("%d\n",table[i][n-1]);
	}

    return 0;
}