#include <iostream>
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <vector>
using namespace std;
string s;
int par[100005],ran[100005];
void init(){ for(int i=0;i<100005;i++)par[i]=i,ran[i]=0;}
int find(int x){
	if(x == par[x]) return x;
	else return par[x] = find(par[x]);
}
void unite(int x,int y){
	x = find(x); y = find(y); if(x==y) return;
	if(ran[x] < ran[y]) par[x] = y;
	else{
		par[y] = x;
		if(ran[x] == ran[y]) ran[x]++;
	}
}
bool same(int x,int y){ return find(x) == find(y);}
int x[100005];
int main() {
	while(1){
		int n,m; scanf("%d%d",&n,&m);
		if(n+m==0) return 0;
		init();
		memset(x,0,sizeof(x)); int out = 0;
		for(int i=0;i<m;i++){
			int a,b; scanf("%d%d",&a,&b);
			if(same(a,b)) out = 1;
			unite(a,b);
			x[a]++; x[b]++;
			if(x[a]>2 || x[b]>2) out=1;
		}
		puts(out?"no":"yes");
	}
	return 0;
}