N,M = gets.chomp.split.map(&:to_i)
sc = M.times.map{gets.chomp.split.map(&:to_i)}

ans =[0]*N

(0...M).each do |i|
  if sc[i][0] == 1 && sc[i][1] == 0
    puts "-1"
    exit
  end
  if ans[sc[i][0]-1] == 0 || ans[sc[i][0]-1] == sc[i][1]
    ans[sc[i][0]-1] = sc[i][1]
  else
    puts "-1"
    exit
  end
end

if ans[0] == 0
  ans[0] = 1
end

puts ans.join