import numpy as np
N,M=map(int,input().split())
s=[list(map(int,input().split())) for _ in range(M)]
for i in range(M):
  if N!=1 and s[i][0]==1 and s[i][1]==0:
    print(-1)
    exit()
z=list(np.zeros(N))
