#include #include using namespace std; using namespace atcoder; int main() { int N, M; cin >> N >> M; vector> G(N); for (int i = 0; i < M; i++) { int A, B; cin >> A >> B; A--; B--; G[A].push_back(B); G[B].push_back(A); } vector P(N, -1); bool ok = true; auto dfs = [&](auto dfs, int v, int p) -> void { P[v] = p; int self = P[v]; for (auto nv : G[v]) { if (P[nv] == -1) { dfs(dfs, nv, P[nv]); } else if (self == P[nv]) { ok = false; } } }; for (int i = 0; i < N; i++) { if (P[i] == -1) { dfs(dfs, i, 0); } } if (ok) { cout << "Yes"; } else { cout << "No"; } }