#include #include #include using namespace std; typedef long long ll; typedef pair pii; #define rep(i, n) for(int i = 0; i < n; ++i) #define ri(a) scanf("%d", &a) #define rii(a, b) scanf("%d%d", &a, &b) #define riii(a, b, c) scanf("%d%d%d", &a, &b, &c) #define Ttimes int T; ri(T); for(int ks = 1; ks <= T; ++ks) const int dx[] = {1, 0, -1, 0}; const int dy[] = {0, 1, 0, -1}; vector g[110]; int in[110]; int main() { int n, m, a, b; while(rii(n, m) == 2) { rep(i, n + 1) { g[i].clear(); in[i] = 0; } rep(i, m) { rii(a, b); g[a].push_back(b); in[b]++; } bool fg = false; rep(i, n) { int x = 0; for(int i = 1; i <= n; ++i) if(in[i] == 0) { x = i; break; } if(x == 0) { fg = true; break; } rep(i, g[x].size()) in[g[x][i]]--; in[x] = -1; } puts(fg ? "NO" : "YES"); } return 0; }