Problems
Farmer John’s cows are showing off their new dance mooves!
At first, all
In minute
In minute
...
In minute
In minute
In minute
and so on ...
For each cow, please determine the number of unique positions in the line she will ever occupy.
Input
The first line contains integers
Output
Print
Example
5 4
1 3
1 2
2 3
2 4
4
4
3
4
1
Cow 1
reaches positions {
Cow 2
reaches positions {
Cow 3
reaches positions {
Cow 4
reaches positions {
Cow 5
never moves, so she never leaves position