#include typedef struct tree { struct tree *p; } tree; tree *get_root (tree *t) { if (t == NULL || t->p == NULL) { return t; } t->p = get_root(t->p); return t->p; } int main () { int n = 0; int m = 0; int a = 0; int b = 0; int res = 0; tree t[400000] = {}; int is_ok = 1; res = scanf("%d", &n); res = scanf("%d", &m); for (int i = 0; i < m; i++) { tree *rt1 = NULL; tree *rt2 = NULL; res = scanf("%d", &a); res = scanf("%d", &b); a--; b--; rt1 = get_root(t+a); rt2 = get_root(t+(b+n)); if (rt1 != rt2) { rt2->p = rt1; } rt1 = get_root(t+(a+n)); rt2 = get_root(t+b); if (rt1 != rt2) { rt2->p = rt1; } } for (int i = 0; i < n; i++) { tree *rt1 = get_root(t+i); tree *rt2 = get_root(t+(i+n)); if (rt1 != rt2) { is_ok = 0; } } if (is_ok > 0) { printf("Yes\n"); } else { printf("No\n"); } return 0; }