n,m=gets.split.map(&:to_i)
r=Array.new(n, nil)
m.times do
  s,c=gets.split.map(&:to_i)
  if !r[s-1].nil? && (r[s-1] != c || (n != 1 && s == 1 && c ==0))
    puts -1
    exit 0
  end
  r[s-1]=c
end

r = r.map { |i| i.nil? ? 0 : i}

r[0] = 1 if r.first == 0 && n!=1
puts r.join




