#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1005;
int parent[MAXN];
int find_set(int v) {
  if (parent[v] == v)
    return v;
  else
    return parent[v] = find_set(parent[v]);
}
int main() {
  ios_base::sync_with_stdio(false);
  int n, m, u, v;
  string ans;
  cin >> n >> m;
  for (int i = 1; i <= n; i++) parent[i] = i;
  ans = "yes";
  for (int i = 0; i < m; i++) {
    cin >> u >> v;
    if (find_set(v) == find_set(u)) ans = "no";
    parent[find_set(v)] = parent[find_set(u)];
  }
  if (ans == "yes") {
    u = find_set(1);
    for (int i = 2; i <= n; i++) {
      if (u != find_set(i)) ans = "no";
    }
  }
  cout << ans << endl;
  return 0;
}
