#include <algorithm>
#include <cstdio>
#include <iostream>
#include <set>
#include <utility>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <deque>
#include <unordered_map>
#include <map>
#include <bitset>
#include <string>
#include <cstring>

#define pb push_back
#define mp make_pair
#define l(x) x << 1
#define r(x) x << 1 | 1
#define scan(x) do {while((x=getchar())<'0') ; for(x-='0'; '0'<=(_=getchar()); x=(x<<3)+(x<<1)+_-'0') ; } while(0)
char _;
#define x first
#define y second

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<float, float> pff;
typedef pair<double, double> pdd;
typedef pair<ll, ll> pll;
typedef map<int, int> mii;
typedef unordered_map<int, int> umii;

int N, x[1005], u;
ll dp1[1005], dp2[1005][5005];
vector<int> adj[1005];

ll go2(int i, int j, int k) {
    if (adj[i].size() <= j) {
        return 0;
    }
    if (dp2[j][k] != -1) {
        return dp2[j][k];
    }

    u = adj[i][j];
    ll ret = 1 << 30;
    if (k + dp1[u] <= x[i]) {
        ret = min(ret, go2(i, j + 1, k + dp1[u]) + x[u]);
    }
    if (k + x[u] <= x[i]) {
        ret = min(ret, go2(i, j + 1, k + x[u]) + dp1[u]);
    }
    return dp2[j][k] = ret;
}

ll go1(int i, int p) {
    if (adj[i].empty()) {
        return dp1[i] = 0;
    }
    if (dp1[i] != -1) {
        return dp1[i];
    }

    for (int j = 0; j < adj[i].size(); j++) {
        u = adj[i][j];
        if (adj[i][j] == p) continue;
        go1(adj[i][j], i);
        for (int k = x[i]; k <= x[i]; k++) {
            if (k - x[u] >= 0) {
                dp2[k] = min(dp2[k], dp2[k - x[u]] + dp2[u]);
            }
            if (k - dp1[u] >= 0) {
                dp2[k] = min(dp2[k], dp2[k - dp1[u]] + x[u]);
            }
        }
    }

    memset(dp2, -1, sizeof dp2);
    return dp1[i] = go2(i, 0, 0);
}

int main() {
    scanf("%d", &N);
    for (int i = 2; i <= N; i++) {
        scanf("%d", &u);
        adj[u].pb(i);
    }
    for (int i = 1; i <= N; i++) {
        scanf("%d", &x[i]);
    }
    memset(dp1, -1, sizeof dp1);
    printf("%s\n", go1(1, 1) < 1 << 30 ? "POSSIBLE" : "IMPOSSIBLE");
}
