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