#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#define ll long long int

typedef struct
{
    int a;
    int b;
} t;

t atob[200002];

int comp(const void *p, const void *q)
{
    return ((t *)p)->a - ((t *)q)->a;
}

int main(void)
{
    int n, m;
    scanf("%d%d", &n, &m);
    int i, swap, a, b;
    int room[100002] = {0}; //room[0]は使わない
    for (i = 1; i < 100002; i++)
    {
        room[i] = 9999999;
    }
    for (i = 0; i < m; i++)
    {
        scanf("%d%d", &a, &b);
        if (a > b)
        {
            swap = a;
            a = b;
            b = swap;
        }
        atob[i].a = a;
        atob[i].b = b;
    }
    qsort(atob, sizeof(int) * 2, sizeof(t), comp);

    room[1] = 1;
    for (i = 0; i < m; i++)
    {
        //printf("%d %d %d %d\n", atob[i].a, atob[i].b, room[atob[i].a], room[atob[i].b]);
        if (room[atob[i].a] < room[atob[i].b])
        {
            room[atob[i].b] = atob[i].a;
        }
        else if (room[atob[i].a] > room[atob[i].b])
        {
            room[atob[i].a] = atob[i].b;
        }
        else
        {
        }
    }
    printf("Yes\n");
    for (i = 2; i <= n; i++)
    {
        printf("%d\n", room[i]);
    }

    return 0;
}