n,m=gets.split.map(&:to_i)
arr=Array.new(n)
flag=true
m.times do
    s,c=gets.split.map(&:to_i)
    
    if arr[s-1].nil? or arr[s-1]==c
        arr[s-1]=c
    else
        flag=false
    end
end
n.times { |i| arr[i]=0 if arr[i].nil?}
flag=false if arr[0]==0 and n!=1
puts flag ? arr.join : -1