N,M = map(int,input().split()) ans = [1]*N for i in range(M): p,q,a,b = map(int,input().split()) assert 1 <= a*b <= 3 print (*ans)