n,m = gets.chomp.split(' ').map(&:to_i)
ans = Array.new(n){false}
m.times do
    s,c = gets.chomp.split(' ').map(&:to_i)
    if (ans[s-1] == false) || (ans[s-1] == c)
        ans[s-1] = c
    else
        puts -1
        exit
    end
end
p ans
if (ans.size == 1) && (ans[0] == 0||ans[0] == false)
    puts 0
elsif (ans[0] == 0)
    puts -1
else
    ans = ans.map{|a| 
                    if a == false
                        0
                    else
                        a
                    end
                }
    if ans[0] == 0
        ans[0] = 1
    end
    puts ans.join
end