#include <iostream>
#include <vector>
#include <deque>
#include <math.h>
#include <set>
#include <iomanip>
#include <time.h>
#include <list>
#include <stdio.h>
#include <queue>
#include <map>
#include <algorithm>
#include <assert.h>
#include <memory.h>

#define mk make_pair
#define sc second
#define fr first
#define pb emplace_back
#define all(s) s.begin(), s.end()
#define sz(s) ( (int)s.size() )
#define ok puts("OK");
#define int long long

using namespace std;

const int N = 1005, inf = 1e9 + 7;

int dp[N], n, x, ar[N], Dp[5005], old[5005];

vector <vector <int> > g;

void Do(int v, int p)
{
    for (int j = 0; j <= ar[v]; j++)
        old[j] = Dp[j] = inf;

    old[0] = 0;

    for (auto to : g[v])
    {
        if (to == p) continue;

        for (int j = 0; j <= ar[v]; j++)
        {
            if(j) Dp[j] = Dp[j - 1];

            if ( j >= ar[to] && Dp[j] > old[j - ar[to]] + dp[to] )
                Dp[j] = old[j - ar[to]] + dp[to];

            else if (j >= dp[to] && Dp[j] > old[j - dp[to]] + ar[to] )
                Dp[j] = old[j - dp[to]] + ar[to];
        }
        for (int j = 0; j <= ar[v]; j++)
            old[j] = Dp[j], Dp[j] = inf;
    }
    for (int j = 0; j <= ar[v]; j++)
        dp[v] = min(dp[v], old[j]);
}

void dfs (int v, int p = 0)
{
    if (g[v].size() == 1 && p)
    {
        dp[v] = 0;
        return ;
    }
    for (auto to : g[v])
    {
        if (to != p)
            dfs(to, v);
    }
    Do(v, p);
}

main ()
{
    cin >> n;

    g.resize(n + 1);

    for (int i = 2; i <= n; i++)
    {
        scanf("%lld", &x);
        g[i].pb(x);
        g[x].pb(i);
    }
    for (int i = 1; i <= n; i++)
    {
        scanf("%lld", &ar[i]);
        dp[i] = inf;
    }
    dfs(1);
    if (dp[1] != inf)
        puts("POSSIBLE");
    else
        puts("IMPOSSIBLE");
}
