Go: package main
import (
	"fmt"
	"bufio"
	"os"
	"bytes"
	"strconv"
	"strings"
)

func nextInt(scanner *bufio.Scanner) int {
	scanner.Scan()
	num , _ :=  strconv.Atoi(scanner.Text())
	return num
}


func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)

	N := nextInt(scanner)
	var A [][]int = make([][]int, N)
	for i:=0; i<N; i++ {
		A[i] = make([]int, N)
	}
	for i:=0; i<N; i++{
		idx := nextInt(scanner)
		cnt := nextInt(scanner)
		for j:=0; j<cnt; j++ {
			node := nextInt(scanner)
			A[idx-1][node-1] = 1
		}
	}
	var outBuffer bytes.Buffer
	for i:=0; i<N; i++ {
		outBuffer.WriteString(strings.TrimRight(fmt.Sprintf("%v",A[i])[1:], "]") + "\n")
	}
	fmt.Printf("%s", outBuffer.String())
}

C++: #include <iostream>
#include <vector>
#define eol '\n'
using namespace std;

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);

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

    vector<int> row(n, 0);
    for (int j = 0; j < k; j++) {
      int v;
      cin >> v;

      row[v-1] = 1;
    }

    // output
    cout << row[0];
    for (int j = 1; j < n; j++) {
      cout << " " << row[j];
    }
    cout << eol;
  }
  
  return 0;
}

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

using namespace std;

// conversion
//------------------------------------------
inline int toInt(string s) {
    int v;
    istringstream sin(s);
    sin >> v;
    return v;
}
template <class T>
inline string toString(T x) {
    ostringstream sout;
    sout << x;
    return sout.str();
}

// math
//-------------------------------------------
template <class T>
inline T sqr(T x) {
    return x * x;
}

// typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

// container util
//------------------------------------------
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i, c) \
    for (typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define EXIST(s, e) ((s).find(e) != (s).end())
#define SORT(c) sort((c).begin(), (c).end())

// repetition
//------------------------------------------
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define REPI(itr, ds) for (auto itr = ds.begin(); itr != ds.end(); itr++)

// constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF_INT = 2147483647;
const LL INF_LL = 9223372036854775807;

// clear memory
//--------------------------------------------
#define CLR(a) memset((a), 0, sizeof(a))

// vector
//--------------------------------------------
template <typename T>
istream &operator>>(istream &is, vector<T> &vec) {
    for (T &x : vec) is >> x;
    return is;
}

// pair
//--------------------------------------------
template <typename T, typename U>
ostream &operator<<(ostream &os, pair<T, U> &pair_var) {
    os << "(" << pair_var.first << ", " << pair_var.second << ")";
    return os;
}

// vector
//--------------------------------------------
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
    os << "{";
    for (int i = 0; i < vec.size(); i++) {
        os << vec[i] << (i + 1 == vec.size() ? "" : ", ");
    }
    os << "}";
    return os;
}

// list
//--------------------------------------------
template <typename T>
ostream &operator<<(ostream &os, const list<T> &lst) {
    os << "{";
    REPI(itr, lst) {
        os << *itr;
        itr++;
        if (itr != lst.end()) os << ", ";
        itr--;
    }
    os << "}";
    return os;
}

// map
//--------------------------------------------
template <typename T, typename U>
ostream &operator<<(ostream &os, map<T, U> &map_var) {
    os << "{";
    REPI(itr, map_var) {
        os << *itr;
        itr++;
        if (itr != map_var.end()) os << ", ";
        itr--;
    }
    os << "}";
    return os;
}

// set
//--------------------------------------------
template <typename T>
ostream &operator<<(ostream &os, set<T> &set_var) {
    os << "{";
    REPI(itr, set_var) {
        os << *itr;
        itr++;
        if (itr != set_var.end()) os << ", ";
        itr--;
    }
    os << "}";
    return os;
}

// dump
//--------------------------------------------
#define DUMPOUT cerr

void dump_func() { DUMPOUT << endl; }
template <class Head, class... Tail>
void dump_func(Head &&head, Tail &&... tail) {
    DUMPOUT << head;
    if (sizeof...(Tail) > 0) {
        DUMPOUT << ", ";
    }
    dump_func(std::move(tail)...);
}
#ifdef DEBUG_
#define DEB
#define dump(...)                                                       \
    DUMPOUT << "  " << string(#__VA_ARGS__) << ": "                     \
            << "[" << to_string(__LINE__) << ":" << __FUNCTION__ << "]" \
            << endl                                                     \
            << "    ",                                                  \
        dump_func(__VA_ARGS__)
#else
#define DEB if (false)
#define dump(...)
#endif

int n;
int m[101][101];

int main(int argc, char *argv[]) {
    cin >> n;
    REP(i, n) REP(j, n) m[i][j] = 0;
    REP(i, n) {
        int u, k;
        cin >> u >> k;
        u--;
        REP(j, k) {
            int x;
            cin >> x;
            x--;
            m[i][x] = 1;
        }
    }
    REP(i, n) {
        REP(j, n) {
            if (j) cout << " ";
            cout << m[i][j];
        }
        cout << endl;
    }
    return 0;
}

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

class Graph
{
  public:
    Graph(int n);

    void Show() const;

  private:
    vector<vector<int>> m_graph;
};

Graph::Graph(int n) :
  m_graph(n, vector<int>(n, 0))
{
  for (int i = 0; i < n; ++i)
  {
    int u, k;
    cin >> u >> k;
    vector<int> list(k);
    for (int j = 0; j < k; ++j)
    {
      cin >> list[j];
    }

    for (auto v : list)
    {
      m_graph[u-1][v-1] = 1;
    }
  }
}

void Graph::Show() const
{
  for (auto a: m_graph)
  {
    for (int i = 0, size = a.size(); i < size; ++i)
    {
      cout << a[i];
      if (i != size - 1)
      {
        cout << " ";
      }
    }
    cout << endl;
  }
}

int main(void)
{
  int n;
  cin >> n;

  Graph graph(n);
  graph.Show();
  return 0;
}

C++: #include <iostream>

using namespace std;

int G[101][101];

int main() {

    int n;
    cin >> n;

    fill(G[0], G[101], 0);

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


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

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

int a[100][100];
int N,u,k,col;
int main() {
	cin >> N;
	for(int i=0; i<N; ++i) {
		cin >> u >> k;
		for(int l=0; l<k; ++l) {
			cin >> col;
			a[u-1][col-1] = 1;
		}
		cout << a[i][0];
		for(int l=1; l<N; ++l) {
			cout << " " << a[i][l];
		}
		cout << endl;
	}
}