def solve
  n, m = gets.split.map!(&:to_i)
  arr = []
  ans = []
  (0..(m - 1)).each do |i|
    arr[i] = gets.split.map!(&:to_i)
  end
  ans[arr[0][0] - 1] = arr[0][1]
  (1..(m - 1)).each do |j|
    ans[arr[j][0] - 1] = arr[j][1]
  end

  return -1 if ans.length != n

  ans.each_with_index do |value, index|
    ans[index] = 0 if value.nil?
  end
  return ans.join
end
print solve
