#include <bits/stdc++.h>
using namespace std;

#define NDEBUG
#include <cassert>

typedef long long ll;
typedef long double Double;
typedef unsigned long long ull;
typedef pair<int,int> ii;
typedef pair<ll,ll> llll;
typedef pair<double,double> dd;

typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<ii> vii;
typedef vector<vector<ii>> vvii;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<long double> vD;

#define sz(a)  int((a).size())
#define pb  push_back
#define FOR(var,from,to) for(int var=(from);var<=(to);++var)
#define rep(var,n)  for(int var=0;var<(n);++var)
#define rep1(var,n)  for(int var=1;var<=(n);++var)
#define repC2(vari,varj,n)  for(int vari=0;vari<(n)-1;++vari)for(int varj=vari+1;varj<(n);++varj)
#define ALL(c)  (c).begin(),(c).end()
#define RALL(c)  (c).rbegin(),(c).rend()
#define tr(i,c)  for(auto i=(c).begin(); i!=(c).end(); ++i)
#define found(s,e)  ((s).find(e)!=(s).end())
#define mset(arr,val)  memset(arr,val,sizeof(arr))
#define mid(x,y) ((x)+((y)-(x))/2)
#define IN(x,a,b) ((a)<=(x)&&(x)<=(b))
#define cons make_pair


ll gcd(ll a, ll b) { while(a) swap(a, b%=a); return b; }

const ll MOD=1000000007LL;

ll ADD(ll x, ll y) { return (x+y) % MOD; }
ll SUB(ll x, ll y) { return (x-y+MOD) % MOD; }
ll MUL(ll x, ll y) { return x*y % MOD; }
ll POW(ll x, ll e) { ll v=1; for(; e; x=MUL(x,x), e>>=1) if (e&1) v = MUL(v,x); return v; }
ll DIV(ll x, ll y) { /*assert(y%MOD!=0);*/ return MUL(x, POW(y, MOD-2)); }



int napsack(vi& diff, int cap){
    int M = diff.size();
    vi dp(cap+1, 0);
    dp[0] = 1;
    rep(i, M) {
        int d = diff[i];
        for (int j=cap-d; j>=0; --j){
            if (dp[j]) dp[j+d] = 1;
        }
    }

    for (int j=cap; j>=0; --j){
        if (dp[j]) return j;
    }
    return 0;
}

int sub(vector<ii>& w, int cap){
    int M = w.size();
    int least = 0;
    vi diff(M, 0);
    rep(i,M){
        int a=w[i].first, b=w[i].second;
        if (a>b) swap(a,b);
        least += a;
        diff[i] = b-a;
    }
    if (least > cap) return -1;
    cap -= least;
    int n = napsack(diff, cap);

    int rem = accumulate(ALL(diff), 0) - n;
    assert(rem >= 0);
    return rem;
}

bool solve(int N, vi& p, vi& x) {
    p.insert(p.begin(), -1);
    assert(p.size() == N);

    vector<vi> children(N);
    rep(i,N){
        int parent = p[i]-1, child = i;
        if (parent < 0) continue;
        assert(IN(parent, 0, N-1));
        children[parent].push_back(child);
    }

    vi topo;
    queue<int> q; q.push(0);
    while (!q.empty()){
        int u = q.front(); q.pop();
        assert(IN(u, 0, N-1));
        topo.push_back(u);
        for (int v: children[u]) {
            q.push(v);
        }
    }
    assert(topo.size() == N);

    vi y(N, 0);
    for (int i=N-1; i>=0; --i){
        int u = topo[i];
        assert(IN(u, 0, N-1));
        if (children[u].empty()) {
            y[u] = 0;
            continue;
        }
        vector<ii> w;
        for (int v: children[u]){
            w.pb(ii(x[v], y[v]));
        }
        y[u] = sub(w, x[u]);
        if (y[u] == -1) return false;
    }
    return true;
}

int main() {
    int N; cin >> N;
    vi p(N-1), x(N);
    rep(i,N-1) cin >> p[i];
    rep(i,N) cin >> x[i];
    cout << (solve(N,p,x) ? "POSSIBLE":"IMPOSSIBLE") << endl;
    return 0;
}


Measured memory_bytes: 384