class UF:
    def __init__(self,n):
        self.p = [-1]*n
    def f(self,x):
        if self.p[x]<0: return x
        else: self.p[x] = self.f(self.p[x]); return self.p[x]
    def u(self,x,y):
        x = self.f(x); y = self.f(y)
        if x==y: return
        if -self.p[x]<-self.p[y]: x,y = y,x
        self.p[x] += self.p[y]; self.p[y] = x
    def s(self,x,y): return self.f(x) == self.f(y)
n,m = map(int,input().split())
uf = UF(2*n)
for _ in range(m):
    a,b = map(int,input().split())
    uf.u(a-1,b-1+n); uf.u(a-1+n,b-1)
ans = "Yes"
for i in range(n):
    if not uf.s(i,i+n): ans = "No"
print(ans)