Competitions

# Floyd - Warshall + Transitive closure

# Transitive closure

Find the transitive closure of the directed graph.

#### Input

Directed graph is given with the list of edges. First line contains number of vertices **n** (**1** ≤ **n** ≤ **100**). Each of the next lines contains two vertices **a** and **b** (**1** ≤ **a**, **b** ≤ **n**) describing the directed edge from **a** to **b**.

#### Output

Print the adjacency matrix of the transitive closure of the graph.

Input example #1

4 4 1 1 2 3 4

Output example #1

0 1 0 0 0 0 0 0 1 1 0 1 1 1 0 0