# include <bits/stdc++.h>

# define pb push_back
# define fr first
# define sc second
# define mk make_pair

using namespace std;

typedef long long ll;
const int inf = 1e9 + 7;
const int N = 5e3 + 1;

int n, x[N], y[N];
vector <int> g[N];

void dfs(int v){
      vector <int> dp(N, 1e9);
      dp[0] = 0;
      for(int to : g[v]){
            dfs(to);
            vector <int> old(N, 1e9);
            for(int i = 0; i <= 5000; i ++){
                  if(i + x[to] <= 5000) old[i + x[to]] = min(old[i + x[to]], dp[i] + y[to]);
                  if(i + y[to] <= 5000) old[i + y[to]] = min(old[i + y[to]], dp[i] + x[to]);
            }
            dp = old;
      }
      for(int i = 0; i <= x[v]; i ++)
            y[v] = min(y[v], dp[i]);
      if(y[v] == 1e9){
            puts("IMPOSSIBLE");
            exit(0);
      }
}

int main(){
      scanf("%d", &n);

      for(int i = 2; i <= n; i ++){
            int p;
            scanf("%d", &p);
            g[p].pb(i);
      }

      for(int i = 1; i <= n; i ++){
            scanf("%d", &x[i]);
            y[i] = 1e9;
      }

      dfs(1);

      puts("POSSIBLE");
}
