object Main extends App {
	val Array(n, m) = scala.io.StdIn.readLine.split(" ").map(_.toInt)

	val a = new Array[Int](n)
	var flag = true

	for(i<-0 until m){
		val Array(s, c) = scala.io.StdIn.readLine.split(" ").map(_.toInt)

		if(a(s-1)  == 0) a(s - 1) = c
		else if(a(s-1) != c) flag = false
	}


	if(a(0) == 0 && n != 1 || !flag){
		println(-1)
	}else{
		println(a.mkString)
	}

}