N, M = gets.split.map(&:to_i)
ans = []
N.times do
  ans.push 0
end

hasAns = true
M.times do
  s, c = gets.split.map(&:to_i)
  s -= 1
  if hasAns && (ans[s] == 0 || ans[s] == c) then
    ans[s] = c
  else
    hasAns = false
  end
end

if N > 1 && ans[0] == 0 then
  hasAns = false
end

if hasAns then
  puts ans.join
else
  puts '-1'
end
