n,m = gets.split.map &:to_i
a = Array.new(n){ -1 }

m.times do
  s,c = gets.split.map &:to_i
  s -= 1

  if a[s] != -1 && a[s] != c
    puts -1
    exit
  end

  a[s] = c
end

n.times do |i|
  if a[i] == -1
    if i == 0
      a[i] = 1
    else
      a[i] = 0
    end
  end
end

if a[0] == 0
  puts -1
else
  puts a.join
end
