<?php
fscanf(STDIN, "%d %d", $N, $M);
$arr = array(0, 0, 0);
for ($m=0; $m<$M; $m++){
    fscanf(STDIN, "%d %d", $s, $c);
    $arr[$s-1] = $c;
}
if ($arr[0] != "0"){
    echo implode($arr);
}else{
    echo "-1";
}
