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

const int N = 1005;

vector <int> g[N];
int x[N], w[N];

int dfs(int u) {
    map <int, int> cnt;
    cnt[x[u]] = 0;
    for (auto & v : g[u]) {
        if (! dfs(v)) return 0;
        map <int, int> tmp;
        for (auto & it : cnt) {
            if (it.first - w[v] >= 0)
                tmp[it.first - w[v]] = it.second + x[v];
            if (it.first - x[v] >= 0)
                tmp[it.first - x[v]] = it.second + w[v];
        }
        cnt = tmp;
    }
    if (cnt.empty()) return 0;
    w[u] = cnt.begin()->second;
    return 1;
}

int main() {
    int n;
    scanf("%d", &n);
    for (int i = 2, p; i <= n; i ++) {
        scanf("%d", &p);
        g[p].emplace_back(i);
    }
    for (int i = 1; i <= n; i ++)
        scanf("%d", x + i);
    puts(dfs(1) ? "POSSIBLE" : "IMPOSSIBLE");
    return 0;
}