Artifacts#9014

Artifacts

1 second
64 megabytes
Hard

Kostya is on a quest to find the new Babylon and has discovered pieces of a map. There are constraints that specify which pieces must be used together. Each constraint is given by two numbers, and , indicating that pieces and can only be used in conjunction.

Input

The first line contains two integers, and , where 1 \leq n, q \leq 3 \times 10^5.The following lines each contain a pair of integers representing the constraints.

Output

Print integers, where the -th integer represents the minimum number of map pieces required to use the -th piece.

Examples

Example 1

Loading
Loading