#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
using ll = long long;
using u64 = uint_fast64_t;
using pii = pair<int, int>;
using pll = pair<long long, long long>;
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007;
//constexpr long long MOD = 998244353;
template<class T1, class T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return true;} return false; }
template<class T1, class T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return true;} return false; }
inline int popcount(int x) {return __builtin_popcount(x);}
inline int popcount(long long x) {return __builtin_popcountll(x);}
void print() { cout << "\n"; }
template<class T, class... Args>
void print(const T &x, const Args &... args) {
    cout << x << " ";
    print(args...);
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////

struct color {
    int b1,w1,b2,w2;
    color(){};
    color(int b1, int w1, int b2, int w2) : b1(b1), w1(w1), b2(b2), w2(w2) {}
};

const int MAX = 5000;
int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    int N; cin >> N;
    vector<vector<int>> G(N);
    rep(i,N-1) {
        int p; cin >> p;
        --p;
        G[p].emplace_back(i+1);
    }
    vector<int> X(N);
    rep(i,N) cin >> X[i];

    auto dfs=[&](auto&& self, int v)->color {
        vector<vector<int>> dp(2, vector<int>(MAX+2,1e9));
        dp[0][0] = 0;
        int cur = 0, nex = 1;
        for (auto nv : G[v]) {
            fill(all(dp[nex]),1e9);
            color c = self(self,nv);
            for (int i = 0; i <= MAX; i++) {
                if (dp[cur][i]==1e9) continue;
                if (c.b1 != 1e9 and c.w1 != 1e9) {
                    chmin(dp[nex][min(i+c.b1,MAX+1)],min(dp[cur][i]+c.w1,MAX+1));
                }
                if (c.b2 != 1e9 and c.w2 != 1e9) {
                    chmin(dp[nex][min(i+c.b2,MAX+1)],min(dp[cur][i]+c.w2,MAX+1));
                }
            }
            swap(cur,nex);
        }
        color ret = color(1e9,1e9,1e9,1e9);
        int wval = *min_element(dp[cur].begin(),dp[cur].begin()+X[v]);
        if (wval != 1e9) {
            ret.b1 = X[v];
            ret.w1 = wval;
        }
        for (int i = 0; i <= MAX+1; i++) {
            if (dp[cur][i] <= X[v]) {
                ret.b2 = i;
                ret.w2 = X[v];
                break;
            }
        }
        return ret;
    };

    color ans = dfs(dfs,0);
    if ((ans.b1 != 1e9 and ans.w1 != 1e9) or (ans.b2 != 1e9 and ans.w2 != 1e9)) {
        cout << "POSSIBLE" << ln;
    } else cout << "IMPOSSIBLE" << ln;
}