#include <bits/stdc++.h>
using namespace std;
int n, m, uu, vv, u, pr[100100], vis[100100];
vector<int> ga[100100];
queue<int> q;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n >> m;
  for (int i = 1; i <= m; i++) {
    cin >> uu >> vv;
    ga[uu].push_back(vv);
    ga[vv].push_back(uu);
  }
  q.push(1);
  vis[1] = true;
  while (q.size()) {
    u = q.front();
    q.pop();
    for (int v : ga[u]) {
      if (!vis[v]) {
        pr[v] = u;
        vis[v] = true;
        q.push(v);
      }
    }
  }
  for (int i = 2; i <= n; i++)
    if (!vis[i]) {
      cout << "No" << endl;
      return 0;
    }
  cout << "Yes" << endl;
  for (int i = 2; i <= n; i++) cout << pr[i] << endl;
  cout << endl;
  return 0;
}
