Go: package main

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

// I/O
type Scanner struct {
	sc *bufio.Scanner
}

func NewScanner() *Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &Scanner{sc}
}

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

func (s *Scanner) nextInt() int {
	i, e := strconv.Atoi(s.nextStr())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *Scanner) nextFloat() float64 {
	f, e := strconv.ParseFloat(s.nextStr(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

func (s *Scanner) nextRuneSlice() []rune {
	return []rune(s.nextStr())
}

func (s *Scanner) nextIntSlice(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextInt()
	}
	return res
}

func (s *Scanner) nextFloatSlice(n int) []float64 {
	res := make([]float64, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextFloat()
	}
	return res
}

// Arithmetic
func max(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m < i {
			m = i
		}
	}
	return m
}

func min(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m > i {
			m = i
		}
	}
	return m
}

func abs(x int) int {
	if x > 0 {
		return x
	}
	return -x
}

func pow(x, y int) int {
	res := 1
	for i := 0; i < y; i++ {
		res *= x
	}
	return res
}

func ceil(a, b int) int {
	if a%b == 0 {
		return a / b
	} else {
		return a/b + 1
	}
}

// Sort
type RuneSlice []rune

func (a RuneSlice) Len() int           { return len(a) }
func (a RuneSlice) Less(i, j int) bool { return a[i] < a[j] }
func (a RuneSlice) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }

// Main
func main() {
	sc := NewScanner()
	wtr := bufio.NewWriter(os.Stdout)
	N := sc.nextInt()
	g := make([][]int, N)
	for i, _ := range g {
		g[i] = make([]int, N)
	}
	for i := 0; i < N; i++ {
		u, k := sc.nextInt(), sc.nextInt()
		for j := 0; j < k; j++ {
			g[u-1][sc.nextInt()-1] = 1
		}
	}

	for _, r := range g {
		for i, num := range r {
			if i > 0 {
				fmt.Fprint(wtr, " ")
			}
			fmt.Fprint(wtr, num)
		}
		fmt.Fprintln(wtr)
	}
	wtr.Flush()
}

C++: #include<iostream>

using namespace std;

#define ll long long

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

    for (ll i=0; i<n; i++){
        for(ll j=0; j<n; j++){
            cout << A[i][j];
        }
        cout << '\n';
    }
}

C++: #include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>

using namespace std;

static const int N = 100;
int M[N][N];


int main(){
	int 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)
	{
		int u, d; cin >> u >> d;
		for (int j = 0; j < d; ++j) {
			int v;  cin >> v;
			M[u - 1][v - 1] = 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,u[100],k[100]={},v[100][100];
  cin >> n;
  for(int i=0; i<n; i++){
    cin >> u[i] >> k[i];

    for(int j=0; j<k[i]; j++)
      cin >> v[i][j];
  }

  for(int i=0; i<n; i++){
    int count=0;
    for(int j=0; j<n; j++){
      if(v[i][count]==j+1){
        cout << 1;
        count++;
      }

      else
        cout << 0;

      if(j!=n)
        cout << " ";
      }

      cout << endl;
    }
  }

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

using namespace std;

int N;

int main()
{
	cin >> N;

	vector<vector<bool> > M(N, vector<bool>(N));

	int u, k, v;

	for (int i = 0; i < N; i++)
	{
		cin >> u >> k;

		for (int i = 0; i < k; i++)
		{
			cin >> v;

			M[u - 1][v - 1] = true;
		}
	}

	for (int i = 0; i < N; i++)
	{
		for (int j = 0; j < N; j++)
		{
			cout << M[i][j];

			if (j != N - 1)
			{
				cout << ' ';
			}
		}

		cout << endl;
	}

	return 0;
}

C++: //Graph
#include <iostream>

using namespace std;

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

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

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

//??£??\?????????????¬??????????????¨???¶???	array[i][j] i??????j???????????????
//??£??\?????????????????????????????????????????????,?????????????¨???¶
//ALDS1_11-A
int n,u,k,a;
int map[101][101];
int main(){
	for(int i=0;i<101;i++){
		for(int j=0;j<101;j++){
			map[i][j]=0;
		}
	}
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>u;
		cin>>k;
		for(int j=0;j<k;j++){
			cin>>a;
			map[u][a]=1;
		}
	}
	for(int i=1;i<n+1;i++){
		for(int j=1;j<n+1;j++){
			cout<<map[i][j];
			if(j!=n) cout<<" ";
			if(j==n&) cout<<endl;
		}
	}
	return 0;
}

C++: #include <map>
#include <set>
#include <list>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <numeric>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <functional>
 
#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
 
using namespace std;
 
typedef    long long          ll;
typedef    unsigned long long ull;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      pii;
 
const int INF=1<<29;
const double EPS=1e-9;
 
const int dx[]={1,0,-1,0},dy[]={0,-1,0,1};
int main(int argc, char const *argv[]) {
	int N;
	cin >> N;
	std::vector<vector<int> > G(N, vector<int>(N));
	for (int i = 0; i < N; ++i) {
		int u, k;
		cin >> u >> k;
		u--;
		for (int j = 0; j < k; ++j) {
			int v;
			cin >> v;
			v--;
			G[u][v] = 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 <cstdio>
using namespace std;

int main(){
    int n;
    scanf("%d",&n);
    int arr[n][n];
    for(int i = 0; i < n; i++){
        for(int j = 0; j < n; j++){
            arr[i][j] = 0;
        }
    }
    for(int i = 0; i < n; i++){
        int u,k;
        scanf("%d %d",&u,&k);
        for(int j = 0; j < k; j++){
            int v;
            scanf("%d",&v);
            arr[u-1][v-1] = 1;
        }
    }
    for(int row = 0; row < n; row++){
        for(int column = 0; column < n; column++){
            printf("%d ",arr[row][column]);
        }
        printf("\n");
    }
}

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

int main() {
    //std::ios::sync_with_stdio(false);
    //std::cin.tie(0);
    int n, u, k, v;
    std::cin >> n;
    for (int i=0; i<n; i++) {
        std::cin >> u >> k;
        int vv[100]={};
        for (int j=0; j<k; j++) {
            std::cin >> v;
            vv[v-1]=1;
        }
        for (int j=0; j<n; j++) {
            std::cout << vv[j];
            if (j == n-1) {
                std::cout << "\n";
            } else {
                std::cout << " ";
            }
        }
    }

    return 0;
}