CF183C Cyclic Coloring

Description

You are given a directed graph $ G $ with $ n $ vertices and $ m $ arcs (multiple arcs and self-loops are allowed). You have to paint each vertex of the graph into one of the $ k $ $ (k

Input Format

The first line contains two space-separated integers $ n $ and $ m $ ( $ 1

Output Format

Print a single integer — the maximum possible number of the colors that can be used to paint the digraph (i.e. $ k $ , as described in the problem statement). Note that the desired value of $ k $ must satisfy the inequality $ 1

Explanation/Hint

For the first example, with $ k=2 $ , this picture depicts the two colors (arrows denote the next color of that color). ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF183C/5fc25b3e1baecb0cc286fd1a3b08fbd0e1f5c4eb.png)With $ k=2 $ a possible way to paint the graph is as follows. ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF183C/8c36834819409d82c5c1224a04a2fcf860f0bd11.png)It can be proven that no larger value for $ k $ exists for this test case. For the second example, here's the picture of the $ k=5 $ colors. ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF183C/6fb597ece64567e61db8b5ed6d1b98f36788eb3f.png)A possible coloring of the graph is: ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF183C/ddb3d14ab97f674110eb33ef458d1f97e9ea4ac4.png)For the third example, here's the picture of the $ k=3 $ colors. ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF183C/a77c6758c9d6428611a620004da04ba72186df31.png)A possible coloring of the graph is: ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF183C/5dc5850b22b6955a11cc6496cce3c42d93bc37c7.png)