#include <bits/stdc++.h>
#define pb          emplace_back
#define ll          long long
#define fi          first
#define se          second
#define mp          make_pair

using namespace std;

typedef pair<int, int> pii;
const int N = 1001;
const int inf = int(1e9);

int n, x[N], p;
vector<int> a[N];

pii DFS(int u) {
    if(a[u].empty()) return mp(x[u], 0);
    bitset<5001> f; int sum = 0;
    f.set(0);
    for(int v: a[u]) {
        pii res = DFS(v);
        f = (f << res.fi | f << res.se);
        sum += res.fi + res.se;
    }
    for(int i = x[u]; i >= 0; --i) if(f[i]) return mp(x[u], sum - i);
    cout << "IMPOSSIBLE"; exit(0);
}

int32_t main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    #define Task        "test"
    if(fopen(Task".inp", "r")) {
        freopen(Task".inp", "r", stdin);
        freopen(Task".out", "w", stdout);
    }
    cin >> n;
    for(int i = 2; i <= n; ++i) cin >> p, a[p].pb(i);
    for(int i = 1; i <= n; ++i) cin >> x[i];
    DFS(1);
    cout << "POSSIBLE";
}
