#include <algorithm>
#include <vector>
#include <iostream>
using namespace std;

vector<vector<int> > adj;
vector<int> x;

void NO() { cout << "IMPOSSIBLE\n"; exit(0); }

int dfs(int i) {
    int dp[x[i]+1];
    dp[0] = 0;
    fill(dp+1, dp+x[i]+1, 1<<30);
    for (int j : adj[i]) {
        int a = x[j], b = dfs(j);
        for (int s = x[i]; s >= 0; s--) {
            int val = 1<<30;
            if (s >= a) val = min(val, dp[s-a]+b);
            if (s >= b) val = min(val, dp[s-b]+a);
            dp[s] = val;
        }
    }
    int ans = *min_element(dp, dp+x[i]+1);
    if (ans == 1<<30) NO();
    return ans;
}

int main() {
    int n; cin >> n;
    adj.resize(n);
    for (int i = 1; i < n; i++) { int p; cin >> p; adj[p-1].push_back(i); }
    x.resize(n);
    for (int i = 0; i < n; i++) cin >> x[i];
    dfs(0);
    cout << "POSSIBLE\n";
}
