#include <bits/stdc++.h>
#pragma GCC optimize("-O3")
using namespace std;
void _main();
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  _main();
}
struct UnionFind {
  vector<int> par, cnt;
  UnionFind(int NV) {
    par.clear();
    cnt.resize(NV, 1);
    for (int i = 0; i < NV; i++) par.push_back(i);
  }
  void reset() {
    for (int i = 0; i < cnt.size(); i++) cnt[i] = 1;
    for (int i = 0; i < par.size(); i++) par[i] = i;
  }
  int operator[](int x) {
    return par[x] == x ? x : par[x] = operator[](par[x]);
  }
  void operator()(int x, int y) {
    x = operator[](x);
    y = operator[](y);
    if (x != y) par[x] = y, cnt[y] += cnt[x];
  }
};
int N, X[1010];
vector<int> E[1010];
string ans = "POSSIBLE";
int dp[1010][2];
void dfs(int cu, int pa = -1) {
  int white = 0, black = 0;
  vector<int> any;
  for (auto &to : E[cu])
    if (to != pa) {
      dfs(to, cu);
      if (dp[to][0] == INT_MAX / 2 && dp[to][1] == INT_MAX / 2) {
        ans = "IMPOSSIBLE";
        return;
      }
      if (dp[to][0] == INT_MAX / 2) {
        white = dp[to][1];
        black = X[to];
      } else if (dp[to][1] == INT_MAX / 2) {
        white = X[to];
        black = dp[to][1];
      } else {
        any.push_back(to);
      }
    }
  vector<int> dp2(10050, INT_MAX / 2);
  dp2[white] = black;
  for (auto &ch : any) {
    vector<int> pd2(10050, INT_MAX / 2);
    for (int i = 5000; i >= 0; i--)
      if (dp2[i] != INT_MAX / 2) {
        pd2[i + X[ch]] = min(pd2[i + X[ch]], dp2[i] + dp[ch][1]);
        pd2[i + dp[ch][0]] = min(pd2[i + dp[ch][0]], dp2[i] + X[ch]);
      }
    swap(dp2, pd2);
  }
  for (int i = 0; i < X[cu] + 1; i++)
    if (dp2[i] != INT_MAX / 2) dp[cu][0] = min(dp[cu][0], dp2[i]);
  dp2.resize(10050, INT_MAX / 2);
  dp2[black] = white;
  for (auto &ch : any) {
    vector<int> pd2(10050, INT_MAX / 2);
    for (int i = 5000; i >= 0; i--)
      if (dp2[i] != INT_MAX / 2) {
        pd2[i + X[ch]] = min(pd2[i + X[ch]], dp2[i] + dp[ch][0]);
        pd2[i + dp[ch][1]] = min(pd2[i + dp[ch][1]], dp2[i] + X[ch]);
      }
    swap(dp2, pd2);
  }
  for (int i = 0; i < X[cu] + 1; i++)
    if (dp2[i] != INT_MAX / 2) dp[cu][1] = min(dp[cu][1], dp2[i]);
}
void _main() {
  cin >> N;
  for (int i = 1; i < N; i++) {
    int P;
    cin >> P;
    P--;
    E[i].push_back(P);
    E[P].push_back(i);
  }
  for (int i = 0; i < N; i++) cin >> X[i];
  for (int i = 0; i < N; i++)
    for (int j = 0; j < 2; j++) dp[i][j] = INT_MAX / 2;
  dfs(0);
  if (dp[0][0] == INT_MAX / 2 && dp[0][1] == INT_MAX / 2) ans = "IMPOSSIBLE";
  for (int i = 0; i < N; i++)
    for (int j = 0; j < 2; j++) printf("dp[%d][%d] = %d\n", i, j, dp[i][j]);
  cout << ans << endl;
}
