#include <bits/stdc++.h>
using namespace std;

int n,m;

vector<vector<int> > vl;

bool findEndPoint(int idx,vector<bool> &v,int pre=-1){
	if(v[idx]){
		return false;
	}
	v[idx] = true;
	if(pre != -1 && vl[idx].size() == 1){
		return true;
	}

	if(vl[idx][0] == pre){
		return findEndPoint(vl[idx][1],v,idx);
	}
	else{
		return findEndPoint(vl[idx][0],v,idx);
	}
}
bool loopNotExist(int idx,vector<bool> &v){
	if(vl[idx].size() == 0){
		return true;
	}
	if(vl[idx].size() == 1){
		return findEndPoint(idx,v);
	}
	bool b1 = findEndPoint(vl[idx][0],v,idx);
	bool b2 = findEndPoint(vl[idx][1],v,idx);
	return b1 && b2;
}

// no branch, no loop
int main(){
	while(scanf("%d%d",&n,&m), !(n==0 && m==0)){
		vl = vector<vector<int> >(n); // adj list
		for(int i = 0; i < n; i++){
			vl[i] = vector<int>();
		}
		for(int i = 0; i < m; i++){
			int u,v;
			scanf("%d%d",&u,&v);
			u--;
			v--;
			vl[u].push_back(v);
			vl[v].push_back(u);
		}
		if(m >= n){
			cout << "no" << endl;
			continue;
		}
		
		// check branch
		bool ok = true;
		for(int i = 0; i < n; i++){
			if(vl[i].size() > 2){
				ok = false;
				break;
			}
		}
		if(!ok){
			cout << "no" << endl;
			continue;
		}


		// check loop
		vector<bool> visited = vector<bool>(n,false);
		int idx = 0;
		while(idx < n){
			if(!visited[idx]){
				ok = loopNotExist(idx,visited);
				if(!ok){
					break;
				}
			}
			idx++;
		}
		if(ok){
			cout << "yes" << endl;
		}
		else{
			cout << "no" << endl;
		}
	}
	return 0;
}

