fn main() {
    let (n, m) = read_tuple();
    let mut ret: Vec<i32> = vec![-1; n];

    for _ in 0..m {
        let (i, c) = read_tuple();
        if ret[i-1] != -1 && ret[i-1] != c as i32 {
            println!("-1");
            return
        }
        ret[i-1] = c as i32;
    }

    for i in 0..n {
        if ret[i] == -1 {
            ret[i] = 0;
        }
    }

    if n != 1 && ret[0] == 0 {
        println!("-1");
        return
    }

    println!("{}", ret.iter().map(|e| e.to_string()).collect::<String>());
}

fn read_tuple() -> (usize, usize) {
    let v = read_vec::<usize>();
    (v[0], v[1])
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().split_whitespace().map(|e| e.parse().ok().unwrap()).collect()
}