n, m = map(int, input().split())
k = []
p = []
for i in range(m):
    l = input().split()
    k.append([int(l[0]), int(l[-1])])

c = 1
for i in range(1, m):
    if k[i][0] not in p:
        if k[i][1] != 1:
            if k[i][0] != c:
                p.append(k[i - 1][0])
                p.append(k[i - 1][1])
                p.append(k[i][0])
                p.append(k[i][1])
                c += 1
        else:
            p.append(k[i][0])
            p.append(k[i][1])

if p[0] == p[-1]:
    print('YES')
    print(*p)
else:
    print('NO')