use std::cmp;

const N: usize = 10;
const INF: usize = 1 << 50;

fn main() {
    let (r, w) = (std::io::stdin(), std::io::stdout());
    let mut sc = IO::new(r.lock(), w.lock());
    let n: usize = sc.read();
    let mut graph = vec![vec![]; n];
    for c in 1..n {
        let p = sc.read::<usize>() - 1;
        graph[p].push(c);
    }
    let w: Vec<usize> = sc.vec(n);

    let (_, b) = dfs(0, &graph, &w);
    if b != INF {
        println!("POSSIBLE");
    } else {
        println!("IMPOSSIBLE");
    }
}

fn dfs(v: usize, graph: &Vec<Vec<usize>>, w: &Vec<usize>) -> (usize, usize) {
    let mut cur = [INF; N];
    cur[0] = 0;
    for &next in graph[v].iter() {
        let (left, right) = dfs(next, graph, w);
        let mut next = [INF; N];
        for one in 0..N {
            if one + left < N {
                next[one + left] = cmp::min(next[one + left], cur[one] + right);
            }
            if one + right < N {
                next[one + right] = cmp::min(next[one + right], cur[one] + left);
            }
        }
        cur = next;
    }

    let w = w[v];
    let mut min = INF;
    for one in 0..N {
        let another = cur[one];
        if one <= w {
            min = cmp::min(another, min);
        }
        if another <= w {
            min = cmp::min(one, min);
        }
    }

    (w, min)
}

pub struct IO<R, W: std::io::Write>(R, std::io::BufWriter<W>);

impl<R: std::io::Read, W: std::io::Write> IO<R, W> {
    pub fn new(r: R, w: W) -> IO<R, W> {
        IO(r, std::io::BufWriter::new(w))
    }
    pub fn write<S: ToString>(&mut self, s: S) {
        use std::io::Write;
        self.1.write(s.to_string().as_bytes()).unwrap();
    }
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .0
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r' || b == b'\t')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r' && b != b'\t')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}
