#define _USE_MATH_DEFINES
#include <math.h>
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

#define F first
#define S second
#define int long long
#define ull  unsigned long long
#define pb push_back

using namespace std;
using namespace __gnu_pbds;
typedef  tree< int , null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

const int N = 5002;
vector < int > g[N];
int x[N], b[N], dp[N][N];
void dfs(int v){
    vector < pair < int, int > > a;
    for (auto u: g[v]){
        dfs(u);
        a.pb({x[u], b[u]});
    }
    if (a.size() == 0){
        b[v] = 0;
    } else{
    for (int i = 0; i <= x[v]; i++)
    for (int j = 0; j <= a.size(); j++) dp[j][i] = 1e9;
    for (int j = 0; j <= x[v]; j++) dp[0][j] = 0;
    for (int i = 1; i <= a.size(); i++){
        int y = a[i - 1].F;
        int z = a[i - 1].S;
        for (int j = 0; j <= x[v]; j++){
            if (j >= y) dp[i][j] = dp[i - 1][j - y] + z;
            if (j >= z) dp[i][j] = min(dp[i][j], dp[i - 1][j - z] + y);
        }
    }
    b[v] = 5e8;
    for (int i = 1; i <= x[v]; i++) b[v] = min(b[v], dp[a.size()][i]);
    if (b[v] == 5e8){
        cout << "IMPOSSIBLE";
        exit(0);
        }
    }
}
main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    //freopen("input.txt",  "r", stdin);
    //freopen("output.txt", "w", stdout);
    int n;
    cin >> n;
    for (int i = 2; i <= n; i++){
        int x;
        cin >> x;
        g[x].pb(i);
    }
    for (int i = 1; i <= n; i++) cin >> x[i];
    dfs(1);
    cout << "POSSIBLE";
}
