#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

int x[5001];
int n;
pair<int,int> dp[1001];
vector<int> e[1001];
bool juu;
void solve(int y)
{
    int sum = 0;
    bitset<5001> p;
    p[0] = 1;
    for (int c: e[y])
    {
        pair<int,int> a = dp[c];
        p = (p<<a.first)|(p<<a.second);
        sum += (a.first+a.second);
    }
    for (int i = x[y]; i >= 0; --i)
        if (p[i])
        {
            dp[y] = {x[y],sum-i};
            return;
        }
    cout << "IMPOSSIBLE";
    exit(0);
    //juu=true;
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cin >> n;
    int c;
    for(int i=2;i<=n; ++i)
    {
        cin >> c;
        e[c].push_back(i);
    }
    for(int i=1; i<=n; ++i) cin >> x[i];
    for(int i=n; i; --i) solve(i);
    //if(juu) cout<<"IMPOSSIBLE"<<endl;
    cout << "POSSIBLE"<<endl;
}
