/*Bismillahir Rahmanir Rahim*///{
#include <bits/stdc++.h>
using namespace std;
using ll = long long; using ull = unsigned long long; using ld = long double;
const ll llinf = (1ll<<61)-1;
const double eps = 1e-6, ldeps = 1e-9;
struct Dbg {
static constexpr auto &os = cout;   // replace by cerr in interactive.
template<class C> static auto dud(C *x)->decltype(os << *x, 0);
template<class C> static char dud(...);
template<class C> typename enable_if<sizeof dud<C>(0)!=1, Dbg&>::type operator<<(const C &x) { os << x; return *this; }
template<class C> Dbg &dump(C b, C e) {
    *this << "\n[";
    int cur = 0;
    for (C i = b; i!=e and cur<26; i++, cur++) *this << ", "+2*(i==b) << *i;
    return *this << ']';
}
template<class C> typename enable_if<sizeof dud<C>(0)==1, Dbg&>::type operator<<(const C &x) {
    return dump(begin(x), end(x));
}
template<class C, size_t X> typename enable_if<sizeof(C)!=1, Dbg&>::type operator <<(C (&x)[X]) {
    return dump(begin(x), end(x));
}
template<class B, class C> Dbg &operator <<(const pair<B, C> &x) {
    return *this << '{' << x.first << ", " << x.second << '}';
}
template<class C, size_t Y> struct TP {
    void operator()(Dbg& os, const C &t) { TP<C, Y-1>()(os, t); os << ", " << get<Y-1>(t); }
};
template<class C> struct TP<C, 1> { void operator()(Dbg& os, const C &t) { os << get<0>(t); } };
template<class... C> Dbg& operator<<(const tuple<C...> &t) {
    os << '{', TP<decltype(t), sizeof...(C)>()(*this, t); return *this << '}';
}
Dbg &operator<<(ostream&(*x)(std::ostream&)) { os << x; return *this; }
} dbg;
void err(istringstream *iss) { delete iss; }
template<class C, class... Args> void err(istringstream *iss, const C &val, const Args &... args) {
    string name; *iss >> name; if (name.back()==',') name.pop_back();
    dbg << name << " = " << val << "; ", err(iss, args ...);
}
#define bug(args...) dbg << __LINE__ << ": ", err(new istringstream(string(#args)), args), dbg << endl
#define sl(a) int(strlen(a))
#define sz(a) int(a.size())
int T, Q, cn;//}
const int inf = 1000000007, mxn = 1005, mxx = 5005;

int n, x[mxn];
list<int> g[mxn];
struct Pair
{
    int mn, mx;
    friend ostream& operator <<(ostream &os, const Pair &rs) {
        return os<<"{"<<"mn: "<<rs.mn<<", "<<"mx: "<<rs.mx<<"}";
    }
    friend istream& operator >>(istream &is, Pair &rs) {
        return is>>rs.mn>>rs.mx;
    }
} dp[mxn];
bitset<mxx> dp2[mxn];

#define yes cout << "POSSIBLE\n", exit(0)
#define no cout << "IMPOSSIBLE\n", exit(0)
#define YN(x) cout << ((x) ? "POSSIBLE\n" : "IMPOSSIBLE\n"), exit(0)

void dfs(const int &u, const int &p) {
    int sumMax = 0, sumMin = 0;
    for (auto &v : g[u]) if (v!=p) {
        dfs(v, u);
        sumMax += dp[v].mx, sumMin += dp[v].mn;
    }
    if (sumMin>x[u]) no;
    if(sumMax<=x[u]){dp[u]={sumMin, x[u]}; return;}

    dp2[0][0] = 1;
    int cur = 0;
    for (auto &v : g[u]) if (v!=p) {
        cur++;
        for (int j = 0; j <= x[u]; j++) {
            if (!dp2[cur-1][j]) continue;
            if (j+dp[v].mn<=x[u]) dp2[cur][j+dp[v].mn] = 1;
            if (j+dp[v].mx<=x[u]) dp2[cur][j+dp[v].mx] = 1;
        }
    }
    int mx = 0;
    for (int i = x[u]; i >= 0; i--) {
        if (dp2[cur][i]) { mx = i; break; }
    }
    for (int i = 0; i <= cur; i++) {
        for (int j = 0; j <= x[u]; j++) {
            dp2[i][j] = 0;
        }
    }
    dp[u] = {min(sumMax+sumMin-mx, x[u]), max(sumMax+sumMin-mx, x[u])};
}

signed main() { ios::sync_with_stdio(0); cin.tie(NULL); cout.precision(11);
/*
We can invert the color of a whole subtree, so specific color doesn't matter, only the ordered pair {mn, mx} matters
where mn denotes min sum of a color in this subtree, mx denotes all the other nodes' sum. Root can be painted correctly
if all sum of mn of all its children <= x[root]. ==> As mx doesn't matter much, we need to keep mn as minimum as possible.
To do that, we satisfy x[root] by sum of mx of children if possible, otherwise, satisfy x[root] by some of the
children's mx (maybe none) and other children's mn. ==> Let's assume we have already taken mx of all children,
we can decrease this by mx-mn for each child, so that total decrement is closest to sumMax-x[cur], can be done by dp.
But here comes an interesting observation, if we generalize the dp state becomes [cntChild][sumMax-x[u]] which can be too
much for a flat tree with every leaf {0, 5000} and x[root] = 0. Hence we can't generalize here. Just normally take mn or
mx of each child, reach as close to <=x[u] as possible, amortized complexity will be [cntChild][x[u]].
Note that, here even though result of dp is bool, I can't find a way to rotate states, as max but less than x[u] is probably
no feasible query.
*/
    cin >> n;
    for (int i = 2; i <= n; i++) {
        int u = i, v;
        cin >> v;
        g[u].push_back(v), g[v].push_back(u);
    }
    for (int i = 1; i <= n; i++) {
        cin >> x[i];
    }

    dfs(1, 0);
    yes;
}

Measured memory_bytes: 1024