#include <bits/stdc++.h>
using namespace std;
long long n, m;
vector<long long> adj[100005];
pair<long long, long long> vist[100005];
void dfs(long long curr, long long par, long long ht) {
  vist[curr] = {par, ht};
  for (auto x : adj[curr]) {
    if (vist[x].first == 0) {
      dfs(x, curr, ht + 1);
    } else {
      if (vist[x].second >= ht + 1) {
        vist[x] = {curr, ht + 1};
      }
    }
  }
}
void solve() {
  cin >> n >> m;
  for (long long i = 0; i < m; i++) {
    long long x, y;
    cin >> x >> y;
    adj[x].push_back(y);
    adj[y].push_back(x);
  }
  dfs(1, -1, 0);
  for (long long i = 2; i <= n; i++) {
    if (vist[i].first == 0) {
      cout << "No";
      return;
    }
  }
  cout << "Yes"
       << "\n";
  for (long long i = 2; i <= n; i++) {
    cout << vist[i].first << "\n";
  }
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long t = 1;
  while (t--) solve();
  return 0;
}
