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