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++: /**
 * @copyright (c) 2020 Daisuke Hashimoto
 */

#include <cstdint>
#include <iostream>
#include <string>

constexpr int32_t kMaxVertexNumber = 110;

void CallGraph(std::istream &input_stream);

class Graph {
 public:
  Graph() noexcept;
  ~Graph() noexcept;

  void AddVertex(const int32_t vertex);
  void MapDirection(const int32_t vertex_number_from, const int32_t vertex_number_to);
  void Print() const noexcept;
  void Reset() noexcept;

 private:
  Graph(const Graph &obj) = delete;
  Graph &operator=(const Graph &obj) = delete;
  Graph(Graph &&obj) = delete;
  Graph &operator=(Graph &&obj) = delete;

  static bool IsInvalidVertexIndex(const int32_t index) noexcept;
  static bool IsInvalidVertexNumber(const int32_t vertex_number) noexcept;
  static int32_t ConvertFromVertexNumberToIndex(const int32_t node_number);
  static int32_t ConvertFromIndexToVertexNumber(const int32_t index);

 private:
  int32_t size_;
  int32_t adjacency_matrix_[kMaxVertexNumber - 1][kMaxVertexNumber - 1];
};

void CallGraph(std::istream &input_stream) {
  input_stream.tie(0);
  std::ios::sync_with_stdio(false);
  Graph *graph = new Graph();
  try {
    int32_t number_of_vertices;
    input_stream >> number_of_vertices;
    for (int32_t i = 0; i < number_of_vertices; ++i) {
      int32_t vertex_number, out_degree;
      input_stream >> vertex_number >> out_degree;
      graph->AddVertex(vertex_number);
      for (int32_t j = 0; j < out_degree; ++j) {
        int32_t tail_vertex;
        input_stream >> tail_vertex;
        graph->MapDirection(vertex_number, tail_vertex);
      }
    }
    graph->Print();
  } catch (...) {
    std::cerr << "ERROR: CallGraph()" << std::endl;
    throw;
  }
  delete graph;
}

// ****************************************************

Graph::Graph() noexcept : size_(0) {
  Reset();
}
Graph::~Graph() noexcept {}

void Graph::AddVertex(const int32_t vertex_number) {
  if (IsInvalidVertexNumber(vertex_number)) {
    std::cerr << "ERROR: AddVertex(): Invalid arg vertex_number = " << vertex_number << std::endl;
    throw 1;
  }
  size_ = (vertex_number > size_) ? vertex_number : size_;
}

void Graph::MapDirection(const int32_t vertex_number_from, const int32_t vertex_number_to) {
  if (IsInvalidVertexNumber(vertex_number_from)) {
    std::cerr << "ERROR: AddVertex(): Invalid arg vertex_number_from = " << vertex_number_from << std::endl;
    throw 1;
  } else if (IsInvalidVertexNumber(vertex_number_to)) {
    std::cerr << "ERROR: AddVertex(): Invalid arg vertex_number_to = " << vertex_number_to << std::endl;
    throw 1;
  } else {
    try {
      int32_t index_from = ConvertFromVertexNumberToIndex(vertex_number_from);
      int32_t index_to = ConvertFromVertexNumberToIndex(vertex_number_to);
      adjacency_matrix_[index_from][index_to] = 1;
    } catch (...) {
      std::cerr << "ERROR: MapDirection()" << std::endl;
      throw;
    }
  }
}

void Graph::Print() const noexcept {
  for (int32_t i = 0; i < size_; ++i) {
    for (int32_t j = 0; j < size_; ++j) {
      if (j != 0) {
        std::cout << " ";
      }
      std::cout << adjacency_matrix_[i][j];
      if (j == size_ - 1) {
        std::cout << std::endl;
      }
    }
  }
}

void Graph::Reset() noexcept {
  for (auto &row : adjacency_matrix_) {
    for (auto &element : row) {
      element = 0;
    }
  }
}

bool Graph::IsInvalidVertexNumber(const int32_t vertex_number) noexcept {
  return ((vertex_number < 1) || (vertex_number > kMaxVertexNumber));
}

bool Graph::IsInvalidVertexIndex(const int32_t index) noexcept {
  return ((index < 0) || (index >= kMaxVertexNumber));
}

int32_t Graph::ConvertFromVertexNumberToIndex(const int32_t vertex_number) {
  const int32_t index = vertex_number - 1;
  if (IsInvalidVertexIndex(index)) {
    std::cerr << "ERROR: ConvertFromVertexNumberToIndex(): Invalid vertex: index = " << index
              << ", vertex_number=" << vertex_number << std::endl;
    throw 1;
  }
  return index;
}

int32_t Graph::ConvertFromIndexToVertexNumber(const int32_t index) {
  if (IsInvalidVertexIndex(index)) {
    std::cerr << "ERROR: ConvertFromIndexToVertexNumber(): Invalid vertex: index = " << index << std::endl;
    throw 1;
  }
  return index + 1;
}

int main(int argc, char *argv[]) {
  try {
    CallGraph(std::cin);
  } catch (...) {
    std::cerr << "ERROR: main()" << std::endl;
  }
  return 0;
}

C++: #include <stdio.h>
#include <iostream>
#include <utility>
#include <algorithm>
#include <math.h>
#include <vector>
using namespace std;

int adj[101][101] = {};

int main()
{
    int n, u, k, v;
    cin >> n;

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

    for (int i = 1; i <= n; i++)
    {
        for (int j = 1; j <= n; j++)
        {
            if (j > 1)
                cout << " ";
            cout << adj[i][j];
        }
        cout << "\n";
    }
    return 0;
}

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

#define MAX 100
#define WHITE 1
#define GRAY 2
#define BLACK 3

using namespace std;

int color[MAX], d[MAX], f[MAX];
int n, A[MAX][MAX];
int tt;

void dfs_visit_1(int u) { //???????????°
    color[u] = GRAY;
    d[u] = ++tt;
    for(int v = 0; v < n; v++) {
        if(A[u][v] == 0) continue;
        if(color[v] == WHITE) dfs_visit_1(v);
    }
    color[u] = BLACK;
    f[u] = ++tt;
}

int next(int u) {
    for(int v = 0; v < n; v++) {
        if(A[u][v] == 1) {
            /*
            if(color[v] == WHITE) return v;
            else if(color[v] == BLACK) return -1;
            else if(color[v] == GRAY) continue;
            */
            return v;
        }
    }
    return -1;
}

void dfs_visit_2(int u) {
    color[u] = GRAY;
    d[u] = ++tt;
    stack<int> S;
    S.push(u);

    while(!S.empty()) {
        int u = S.top();
        int v = next(u);
        if(v != -1) {
            if(color[v] == WHITE) {
                color[v] = GRAY;
                d[v] = ++tt;
                S.push(v);
            }
        }else {
            S.pop();
            color[u] = BLACK;
            f[u] = ++tt;
        }
    }
}

void dfs_1() { // ???????????°
    for(int i = 0; i < n; i++) {
        color[i] = WHITE;
    }
    tt = 0;
    for(int i = 0; i < n; i++) {
        if(color[i] == WHITE) dfs_visit_2(i);
    }

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

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

    
    for(int i = 0; i < n; i++) {
        for(int j = 0; j < n; j++) {
            printf("%d", A[i][j]);
            if(j != n-1) printf(" ");
        }
        printf("\n");
    }
    
    //dfs_1();
    
    return 0;
}