#include<cstdio>
#include
<iostream>
#include
<vector>
using namespace std;
vector
<int>adj[1002];
int n,m;
bool f[1002];
void dfs(int v){
    f[v]
=1;
    
for(int i=0;i<adj[v].size();i++){
        
if(f[adj[v][i]]==1)
            
continue;
        dfs(adj[v][i]);
    }
}
int main()
{
    
int i,j;
    
while(scanf("%d %d",&n,&m),n||m){
        
if(m!=n-1){
            
while(m--)
                scanf(
"%d%d",&i,&j);
            printf(
"No\n");
            
continue;
        }
        
int a,b;
        
for(i=1;i<=n;i++)
            adj[i].clear();
        
while(m--){
            scanf(
"%d%d",&a,&b);
            adj[a].push_back(b);
            adj[b].push_back(a);
        }
        memset(f,
0,sizeof(f));
        dfs(
1);
        
for(i=1;i<=n;i++){
            
if(f[i]==0)
                
break;
        }
        
if(i>n)    printf("Yes\n");
        
else    printf("No\n");
        
    }
}
posted on 2009-05-19 22:49  pandy  阅读(190)  评论(0编辑  收藏  举报