n=gets.to_i
if n==1 then
    p true
    exit(0)
end
p=gets.split(" ").map{|i|i.to_i-1}
p.unshift 0
x=gets.split(" ").map(&:to_i)
edge=Array.new(n){[]}
isLeaf=Array.new(n,true)
sum=Array.new(n,0)
n.times{|i|
    isLeaf[p[i]]=false
    if p[i]!=i then
        edge[p[i]].<<i
    end
}
[*0...n].reverse_each{|i|
    if isLeaf[i] then
        sum[i]=x[i]
        next
    end
    edge[i].each{|from|
        sum[i]+=sum[from]
    }
    ok=Array.new(x[i]+1,false)
    ok[0]=true
    usezero=false
    edge[i].each{|from|
        a=x[from]
        b=sum[from]-x[from]
        usezero|=(a==0)|(b==0)
        [*0..x[i]].reverse_each{|j|
            if !ok[j] then
                next
            end
            if j+a<=x[i] then
                ok[j+a]=true
            end
            if j+b<=x[i] then
                ok[j+b]=true
            end
        }
    }
    ok[0]=usezero
    black=-1
    [*0..x[i]].reverse_each{|j|
        if ok[j] then
            black=j
            break
        end
    }
    if black==-1 then
        puts "IMPOSSIBLE"
        exit(0)
    end
    sum[i]=sum[i]-black+x[i]
}
puts "POSSIBLE"