#include <bits/stdc++.h>
using namespace std;
int n;
const int N = 6000;
vector <int> bi[N];
int xi[N];
int dfs(int t)
{
    int s = 0;
    bitset <N> X;
    X[0] = 1;
    for (int i = 0; i < bi[t].size(); ++ i)
    {
        int v = dfs(bi[t][i]);
        s += v + xi[bi[t][i]];
        X = (X << xi[bi[t][i]]) | (X << v);
    }
    int v = xi[t];
    while (v && !X[v]) v --;
    if (!X[v])
    {
        puts("IMPOSSIBLE");
        exit(0);
    }
    return s - v;
}
int main()
{
    cin >> n;
    for (int i = 2; i <= n; ++ i)
    {
        int p;
        cin >> p;
        bi[p].push_back(i);
    }
    for (int i = 1; i <= n; ++ i) cin >> xi[i];
    dfs(1);
    puts("POSSIBLE");
}
