n, m = map(int, input().split()) for _ in range(m): p, q, a, b = map(int, input().split()) if a < 0: print(-1) exit() ANS = [1] * n print(*ANS)