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

coords = []
ymax = 0
ymin = 1000
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
    if y1 < ymin:
        ymin = y1

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

hunters = [i for i in range(n)]

for coord in coords:
    hunters[coord["x1"]], hunters[coord["x2"]] = hunters[coord["x2"]], hunters[coord["x1"]]

for hunter in (hunters):
    print(hunter+1)

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



"""