n, m = map(int, input().split())
a = []
b = []
index = False
for _ in range(m):
    ai, bi = map(int, input().split())
    a.append(ai)
    b.append(bi)

def rec(a, b, num, lenl, count, res, n):
    if count==n+1:
        if res[-2]=='1':
            print("YES")
            print(res)
        return 0
    index = False
    for i in range(lenl):
        if a[i]==num:
            rec(a, b, b[i], lenl, count + 1, res + str(b[i]) + " ", n)
            index = True
    if index==False:
        return -1

result = rec(a, b, 1, m, 1, "1 ", n)