N,M=map(int,input().split()) for i in range(M): p,q,a,b=map(int,input().split()) if a<0: print(-1);exit() print(*([1]*N))