AT_past202209_d 採点
Description
Mr. Aoki gave Takahashi, his student, an assignment that asked him to make a simple undirected graph.
An undirected graph is **simple** when both of the following conditions are satisfied.
- There are no **multi-edges**. That is, for any two vertices $ u $ and $ v $ , there is at most one edge connecting $ u $ and $ v $ .
- There are no **self-loops**. That is, for any vertex $ v $ , there is no edge connecting $ v $ and $ v $ itself.
Takahashi writes his undirected graph $ G $ in the following format in his notebook and submits it to his teacher.
> $ N $ $ M $ $ u_1 $ $ v_1 $ $ u_2 $ $ v_2 $ $ \vdots $ $ u_M $ $ v_M $
Here, $ N $ and $ M $ are the numbers of vertices and edges in $ G $ , respectively, and $ u_i $ and $ v_i $ for each $ i = 1, 2, \ldots, M $ means that the $ i $ -th edge connects Vertex $ u_i $ and Vertex $ v_i $ .
Mr. Aoki will check whether Takahashi's writing correctly describes a simple undirected graph. More accurately, the teacher will check whether both of the following are satisfied.
- $ 1 \leq u_i \leq N $ and $ 1 \leq v_i \leq N $ , for every $ i = 1, 2, \ldots, M $ .
- The undirected graph described is simple.
Put yourself in Mr. Aoki's shoes and check whether Takahashi's writing satisfies both conditions above.
Input Format
Input is given from Standard Input in the following format:
> $ N $ $ M $ $ u_1 $ $ v_1 $ $ u_2 $ $ v_2 $ $ \vdots $ $ u_M $ $ v_M $
Output Format
If Takahashi's writing satisfies both of the conditions in the Problem Statement, print `Yes`; otherwise, print `No`.
Explanation/Hint
### Sample Explanation 1
Here we have $ N = 3 $ and $ v_3 = 4 $ , which is in violation of $ 1 \leq v_3 \leq N $ . Therefore, `No` should be printed.
### Sample Explanation 2
This undirected graph has two edges connecting Vertex $ 1 $ and Vertex $ 2 $ and thus is not simple. Therefore, `No` should be printed.
### Sample Explanation 3
This undirected graph has a self-loop connecting Vertex $ 1 $ and itself and thus is not simple. Therefore, `No` should be printed.
### Constraints
- $ 1 \leq N, M \leq 2 \times 10^5 $
- $ 1 \leq u_i, v_i \leq 2 \times 10^5 $
- All values in input are integers.