#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;
const long long INFLL = 1e18;
int dx[4] = {0, -1, 1, 0}, dy[4] = {-1, 0, 0, 1};
const int MAX_X = 5000, MAX_N = 1000;
int dp[1000];
int dp2[MAX_N + 1][MAX_X + 1];
vector<int> X;
vector<vector<int>> G;
int N;
void dfs(int v) {
  for (auto u : G[v]) dfs(u);
  int M = G[v].size();
  fill(dp2[0], dp2[0] + MAX_N * MAX_X, INF);
  dp2[0][0] = 0;
  for (int i = 0; i < M; i++) {
    int u = G[v][i];
    int b = dp[u], w = X[u];
    for (int x = MAX_X; x >= 0; x--) {
      if (x + b <= MAX_X)
        dp2[i + 1][x + b] = min(dp2[i + 1][x + b], dp2[i][x] + w);
      if (x + w <= MAX_X)
        dp2[i + 1][x + w] = min(dp2[i + 1][x + w], dp2[i][x] + b);
    }
  }
  dp[v] = INF;
  for (int x = 0; x <= X[v]; x++) {
    dp[v] = min(dp[v], dp2[M][x]);
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin >> N;
  G.resize(N);
  X.resize(N);
  for (int i = 1; i < N; i++) {
    int P;
    cin >> P;
    P--;
    G[P].push_back(i);
  }
  for (int i = 0; i < (int)(N); i++) cin >> X[i];
  dfs(0);
  cout << (dp[0] < INF ? "POSSIBLE" : "IMPOSSIBLE") << endl;
}
