#include <bits/stdc++.h>
using namespace std;
int pre[1005], flag;
int getfather(int x) {
  if (x == pre[x]) return pre[x];
  pre[x] = getfather(pre[x]);
  return pre[x];
}
void unio(int a, int b) {
  int aa = getfather(a);
  int bb = getfather(b);
  if (aa == bb) {
    flag = 0;
    return;
  }
  pre[aa] = bb;
}
int main() {
  int n, m;
  cin >> n >> m;
  flag = 1;
  for (int i = 1; i <= n; i++) pre[i] = i;
  while (m--) {
    int a, b;
    cin >> a >> b;
    unio(a, b);
  }
  int gg;
  for (int i = 1; i <= n; i++) {
    if (i == 1)
      gg = getfather(i);
    else {
      if (getfather(i) != gg) flag = 0;
    }
  }
  if (flag)
    cout << "yes" << endl;
  else
    cout << "no" << endl;
  return 0;
}
