t = input()
(N, M) = t.split(" ")
N = int(N)
M = int(M)

rowm = {}

for i in range(M):
    t = input()
    (x1, y1, x2, _) = t.split(" ")
    x1 = int(x1)
    y = int(y1)
    x2 = int(x2)
    if y in rowm:
        rowm[y].append((x1,x2))
    else:
        rowm[y] = [(x1,x2)]

players = [i for i in range(N)]
ys = sorted(rowm.keys())
for y in ys:
    for (x1, x2) in rowm[y]:
        (players[x1-1], players[x2-1]) = (players[x2-1], players[x1-1])

positions = [-1] * N
for x in players:
    positions[players[x]] = x + 1

for p in positions:
    print(p)