#include <cstdio>
#include <iostream>
#include <vector>
#include <stack>
#include <cstring>

using namespace std;

const int MAXN = 2005;

int n, N, cnt, ok, num[MAXN], low[MAXN];
vector<int> conn[MAXN];
bool vis[MAXN];
stack<int> stk;
bool instk[MAXN], chk[MAXN];

int fix(int a){
	if(a < 0) return -a + n;
	return a;
}

int ano(int a){
	if(a <= n) return a + n;
	return a - n;
}

void add_conf(int a, int b){
	a = fix(a); b = fix(b);
	int aa = ano(a), bb = ano(b);
	conn[a].push_back(bb);
	conn[b].push_back(aa);
}

void dfs(int x)
{
    vis[x] = 1;
    num[x] = low[x] = ++cnt;
    stk.push(x);
    instk[x] = 1;
    for(int i=0;i<conn[x].size();i++)
    {
        int v = conn[x][i];
        if(!vis[v])
        {
            dfs(v);
            if(low[x] > low[v]) low[x] = low[v];
        }
        else if(instk[v])
            if(low[x] > low[v]) low[x] = low[v];
    }
    if(low[x] == num[x])
    {
        memset(chk, 0, sizeof(chk));
        int w;
        do
        {
            w = stk.top();
            stk.pop();
            instk[w] = 0;
            chk[w] = 1;
        }while(w != x);
        for(int i=1; i<=n; i++)
            if(chk[i] && chk[i+n])
                ok = 0;
    }
}

bool test(){
	memset(vis, 0, sizeof(vis));
	cnt = 0;
    ok = 1;
    for(int i=1;i<=N;i++)
        if(!vis[i]){
            dfs(i);
            if(!ok)
                return false;
        }
    return true;
}

void clear(){
	for(int i = 1; i <= N; i++) conn[i].clear();
	conn[n+1].push_back(1);
}

int main(){
	int m;
	while(2 == scanf("%d %d", &n, &m)){
		N = 2 * n;
		clear();
		while(m--){
			int a, b;
			scanf("%d %d", &a, &b);
			add_conf(-a, -b);
		}
		if(test()) puts("yes");
		else puts("no");
	}
	return 0;
}
