#include <bits/stdc++.h>
#define X first
#define Y second
#define pb emplace_back
#define FOR(i,a,b) for(int (i)=(a);i<(b);++(i))
#define EFOR(i,a,b) for(int (i)=(a);i<=(b);++(i))
#define rep(X,Y) for (int (X) = 0;(X) < (Y);++(X))
#define reps(X,S,Y) for (int (X) = S;(X) < (Y);++(X))
#define rrep(X,Y) for (int (X) = (Y)-1;(X) >=0;--(X))
#define rreps(X,S,Y) for (int (X) = (Y)-1;(X) >= (S);--(X))
#define all(X) (X).begin(),(X).end()
#define rall(X) (X).rbegin(),(X).rend()
#define eb emplace_back
#define UNIQUE(X) (X).erase(unique(all(X)),(X).end())

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef ll LL;
typedef pii PII;
typedef pll PLL;
template<class T> using vv=vector<vector<T>>;
template<class T> inline bool MX(T &l,const T &r){return l<r?l=r,1:0;}
template<class T> inline bool MN(T &l,const T &r){return l>r?l=r,1:0;}
const ll MOD=1e9+7;

const int INF = 0x3fffffff;

int N;
vector<int> es[114514];
int X[114514];
int W[114514];

int dfs(int v) {
  int M = es[v].size();
  vector<int> dp[2];
  rep(i, 2) dp[i].resize(5001);

  int src = 0;
  int dst = 1;
  dp[src][0] = 0;

  int mins = 0;
  for (int u : es[v]) {
    int w = dfs(u);
    mins += min(w, X[u]);

    fill(all(dp[dst]), INF);
    rep(i, 5001) {
      if (i+w < 5001) dp[dst][i+w] = min(dp[dst][i+w], dp[src][i]+X[u]);
      if (i+X[u] < 5001) dp[dst][i+X[u]] = min(dp[dst][i+X[u]], dp[src][i]+w);
    }
    swap(src, dst);
  }

  if (v == 0) {
    if (mins > X[0]) {
      puts("IMPOSSIBLE");
      exit(0);
    } else return;
  }

  rep(i, 5001) {
    if (dp[src][i] <= X[v]) return i;
  }

  puts("IMPOSSIBLE");
  exit(0);
}

int main() {
  scanf("%d", &N);
  reps(i, 1, N) {
    int p;
    scanf("%d", &p);
    --p;
    es[p].eb(i);
  }

  rep(i, N) {
    scanf("%d", &X[i]);
  }

  dfs(0);
  puts("POSSIBLE");
}
