#include <bits/stdc++.h>
using namespace std;
int f[1010];
bool flag = false;
int get(int x) {
  while (f[x] != x) {
    x = f[x];
  }
  return x;
}
int main() {
  int n, m, x, y, f1, f2;
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    f[i] = i;
  }
  for (int i = 0; i < m; i++) {
    cin >> x >> y;
    if (flag) continue;
    f1 = get(x), f2 = get(y);
    if (f1 == f2) {
      flag = true;
    } else {
      f[x] = f1;
      f[y] = f1;
      f[f2] = f1;
    }
  }
  if (!flag) {
    int fa = get(1);
    for (int i = 2; i <= n; i++) {
      if (fa != get(i)) {
        flag = true;
        break;
      }
    }
  }
  if (!flag)
    cout << "yes" << endl;
  else
    cout << "no" << endl;
  return 0;
}
