Network
Time limit2.5sMemory limit1024 MB
For each link, count the computers whose removal disconnects the network after that link is deleted, and print one count per link.
Problem
A network is made of computers and links. The computers are numbered from to . Each link lets two different computers communicate in both directions. A network is connected if any two of its computers can communicate using one or more links. If there is a pair of computers that cannot communicate, the network is disconnected.
The danger level of a link is defined as follows.
- For each computer in the network, if the remaining network is disconnected after removing computer , computer is called a dangerous computer.
- The danger level of is the number of dangerous computers in the initial network after removing .
Input
The first line contains two integers and . (, )
Each of the next lines contains and . Link connects computer and computer . (, )
Output
Print lines. The -th line is the danger level of link .
Constraints
- Each link connects two different computers.
- Multiple links may connect the same pair of computers.
- The initial network is connected.