(N, M), *SCs = readlines.map{|l| l.split.map(&:to_i)}

x = Array.new(N, nil)
SCs.each do |s, c|
  s -= 1
  case x[s]
  when nil, c
    x[s] = c
  else
    puts -1
    exit
  end
end
case x[0]
when nil
  x[0] = 1
when 0
  puts -1
  exit
end
(1 .. N - 1).each{|i| x[i] = 0 if x[i].nil?}
puts x.join