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

const int INF = (int) 1e9 + 7;
const int N = 1000;
vector<int> child[N];
int sum[N], black[N];

bool dfs(int u) {
    vector<int> f (sum[u] + 1, INF);
    f[0] = 0;
    for (auto v : child[u]) {
        if (!dfs(v)) return false;
        vector<int> g (sum[u] + 1, INF);
        for (int i = 0; i + sum[v] <= sum[u]; ++i) {
            g[i + sum[v]] = min(g[i + sum[v]], f[i] + black[v]);
        }
        for (int i = 0; i + black[v] <= sum[u]; ++i) {
            g[i + black[v]] = min(g[i + black[v]], f[i] + sum[v]);
        }
        f = g;
    }
    black[u] = *min_element(f.begin(), f.end());
    return black[u] < INF;
}

int main() {
    ios::sync_with_stdio(false);
    int n; cin >> n;
    for (int i = 1; i < n; ++i) {
        int p; cin >> p; --p;
        child[p].emplace_back(i);
    }
    for (int i = 0; i < n; ++i) cin >> sum[i];
    cout << (dfs(0) ? "POSSIBLE" : "IMPOSSIBLE") << '\n';
    return 0;
}
