use std::cmp::min;

const INF: usize = 1 << 60;
// const X: usize = 5001;
const X: usize = 10;

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 i in 1..n {
        let p = sc.read::<usize>() - 1;
        graph[p].push(i);
    }

    let x: Vec<usize> = sc.vec(n);
    let (a, _) = dfs(0, &graph, &x);
    if a != INF {
        println!("POSSIBLE");
    } else {
        println!("IMPOSSIBLE");
    }
}

fn dfs(v: usize, graph: &Vec<Vec<usize>>, x: &Vec<usize>) -> (usize, usize) {
    if graph[v].is_empty() {
        return (0, x[v]);
    }

    let mut dp = vec![INF; X];
    dp[0] = 0;
    for &child in graph[v].iter() {
        let mut next = vec![INF; X];
        let (a, b) = dfs(child, graph, x);
        for cur in 0..X {
            if cur + a < X {
                next[cur + a] = min(next[cur + a], dp[cur] + b);
            }
            if cur + b < X {
                next[cur + b] = min(next[cur + b], dp[cur] + a);
            }
        }
        dp = next;
    }

    let mut ans = INF;
    for i in 0..X {
        if dp[i] <= x[v] {
            ans = min(ans, i);
        }
        if i <= x[v] {
            ans = min(ans, dp[i]);
        }
    }
    (ans, x[v])
}

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) -> Self {
        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()
    }
}
