N, M = gets.split.map(&:to_i)
nums = Array.new(N)
lists = []
M.times do
  lists << gets.split.map(&:to_i)
end
# binding.pry
lists.each do |s, t|
  if nums[s-1] && nums[s-1] != t
    puts -1
    exit
  end
  nums[s-1] = t
end

if nums[0] == 0
  puts -1
  exit
end
# binding.pry
check = false
nums.each_index do |i|
  if nums[i]
    check = true
  end
  if !nums[i]
    if check
      nums[i] = 0
    end
  end
end
puts nums.compact.join