Strong Connected Components
We call a strongly connected component in a directed graph an arbitrary set of vertices such that every vertex in this set there is a path to any other vertex of the set, and there is another set with the same property that contains this set.
Given a directed graph. Find the number of different components of strong connectivity in it.
The first line contains two integers n and m (1 ≤ n ≤ 10, 0 ≤ m ≤ 90) - number of vertices and edges in the graph, respectively. The next m lines describe the edges: i-th of these lines contains two integers
vi (1 ≤
vi ≤ n) - the start and the end of the i-th edge respectively. It is guaranteed that the graph has no loops or multiple edges.
The first line of the output file output a single number - the number of strongly connected components of the graph.
3 2 1 2 2 3
5 4 3 1 1 2 2 3 4 5