N,M=map(int,input().split()) for _ in range(M): p,q,x,y=map(int,input().split()) if x<0 and y<0: exit(print(-1)) print(*[1]*N)