n,m = map(int,input().split())

coords = []
ymax = 0
for i in range(m):
    x1, y1, x2, y2 = map(int,input().split())
    coord = {"x1": x1-1, "x2": x2-1, "y": y1}
    coords.append(coord)
    if y1 > ymax:
        ymax = y1

coords.sort(key=lambda x: x["y"], reverse=True)

hunters = [i for i in range(n)]
coords_idx = 0
coords_len = len(coords)
y=ymax+1
# print(f"ymax: {ymax}")
# print(coords)
while True:
    y -= 1
    if y == 0:
        break

    if coords_idx >= coords_len:
        break
    while coords[coords_idx]["y"] == y:
        x1, x2 = coords[coords_idx]["x1"], coords[coords_idx]["x2"]
        # print(f"x1: {x1}, x2: {x2}, y: {y}")
        # print(f"hunters: {hunters}")
        hunters[x1], hunters[x2] = hunters[x2], hunters[x1]
        coords_idx += 1
        if coords_idx >= coords_len:
            break
for hunter in (hunters):
    print(hunter+1)

"""
3 2
1 1 2 1
2 2 3 2



"""