n, m = gets.chomp.split(" ").map(&:to_i)
s, c = m.times.map{gets.split.map(&:to_i)}.transpose
nums = []
n.times { nums << 0 }
if n != 1
  nums[0] = 1
end

flag = true

(0...m).each do |j|
  (j+1...m).each do |k|
    if s[j] == s[k] && c[j] != c[k]
      puts -1
      flag = false
      break
    end
  end
end

if flag
  (0...m).each do |i|
    if c[i] == 0
      puts -1
      flag = false
      break
    elsif s[i] > n
      puts -1
      flag = false
      break
    end
    nums[s[i]-1] = c[i] 
  end
end

if flag
  puts nums.join
end