parseInt(x) = parse(Int, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)

function main()
	n,m = readline() |> split |> parseMap
	a = -ones(Int,n)
	f = 0
	for i in 1:m
		s,c = readline() |> split |> parseMap
		if a[s]==-1
			a[s] = c
		elseif a[s]!=c
			f = 1
		end
	end
	if f == 1 || a[1]==0
		println(-1)
	else
		if a[1]==-1
			print(1)
		else
			print(a[1])
		end
		for i in 2:n
			if a[i]==-1
				print(0)
			else
				print(a[i])
			end
		end
		println("")
	end
end

main()