n, m = map(int, input().split())
a = []
b = []
index = False
for _ in range(m):
    ai, bi = map(int, input().split())
    if bi==1:
        index=True
    a.append(ai)
    b.append(bi)
if index==False:
    print("NO")
else:
    def rec(a, b, num, lenl, count, res, n):
        if count==n+1:
            if res[-2]=='1':
                print("YES")
                print(res)
                end = True
            return 0
            result = True
        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
    rec(a, b, 1, m, 1, "1 ", n)
    print("NO")