#include <bits/stdc++.h>
using namespace std;
const int INF = 1005;
int father[INF];
int find(int x) {
  if (father[x] == x)
    return x;
  else
    return father[x] = find(father[x]);
}
int main() {
  int N, M;
  scanf("%d%d", &N, &M);
  for (int i = 1; i <= N; i++) father[i] = i;
  int flag = 1;
  while (M--) {
    int x, y;
    scanf("%d%d", &x, &y);
    if (flag) {
      x = find(x);
      y = find(y);
      if (x == y)
        flag = 0;
      else
        father[x] = y;
    }
  }
  if (flag == 0)
    printf("no\n");
  else {
    int sum = 0;
    for (int i = 1; i <= N; i++)
      if (father[i] == i) sum += 1;
    if (sum > 1)
      printf("no\n");
    else
      printf("yes\n");
  }
  return 0;
}
