#T656. 通信系统
通信系统
Here is the translated text while preserving all formatting and code blocks:
## Description
<p><span style="color: rgba(0, 0, 0, 0.87);">A city plans to build a communication system. According to the design, this system consists of several endpoints connected by communication cables. Messages can be generated at any endpoint and can only be transmitted via cables. Upon receiving a message, each endpoint will forward it to all connected endpoints except the one from which the message was received. If the endpoint is the one where the message originated, it will transmit the message to every connected endpoint.</span></p><p><span style="color: rgba(0, 0, 0, 0.87);">To improve transmission efficiency and conserve resources, it is required that when a message is generated at any endpoint, all other endpoints must receive the message exactly once without any duplicates.</span></p><p><span style="color: rgba(0, 0, 0, 0.87);">Given the description of the communication system, can you determine whether it meets the above requirements?</span></p>
## Input Format
<p><span style="color: rgba(0, 0, 0, 0.87);">The input contains multiple test cases. Each pair of test cases is separated by a blank line.</span></p><p><span style="color: rgba(0, 0, 0, 0.87);">For each test case, the first line contains two integers N and M, where N (1 ≤ N ≤ 1000) represents the number of endpoints, and M (0 ≤ M ≤ N*(N-1)/2) represents the number of communication cables.</span></p><p><span style="color: rgba(0, 0, 0, 0.87);">The following M lines each contain two integers A and B (1 ≤ A, B ≤ N), indicating that endpoints A and B are connected by a communication cable. There is at most one direct cable between any two endpoints, and no cable connects an endpoint to itself.</span></p><p><span style="color: rgba(0, 0, 0, 0.87);">The input ends when both N and M are 0.</span></p>
## Output Format
<p><span style="color: rgba(0, 0, 0, 0.87);">For each test case, output "Yes" if the given system meets the requirements, otherwise output "No".</span><br /></p>
4 3
1 2
2 3
3 4
3 1
2 3
0 0
Yes
No
来源
CodesOnline