#include <bits/stdc++.h>
using namespace std;
void openFile() {
  ios_base ::sync_with_stdio(false);
  cin.tie(NULL);
}
const int maxN = 1e3 + 5;
const int maxM = 5e3 + 5;
const long long INF = 1e9 + 7;
int N;
vector<int> vertex[maxN];
int X[maxN];
int dp[2][maxN];
int g[2][maxM], f[2][maxM];
void enter() {
  cin >> N;
  for (int i = 2; i <= N; ++i) {
    int p;
    cin >> p;
    vertex[p].push_back(i);
  }
  for (int i = 1; i <= N; ++i) {
    cin >> X[i];
  }
}
void dfs(int u, int p) {
  for (int i = 0; i < vertex[u].size(); ++i) {
    int v = vertex[u][i];
    dfs(v, u);
  }
  fill_n(&g[0][0], 2 * maxM, INF);
  g[0][0] = g[1][0] = 0;
  for (int i = 0; i < vertex[u].size(); ++i) {
    int v = vertex[u][i];
    for (int d = 0; d <= X[u]; ++d) {
      if (d >= X[v]) {
        f[0][d] = min(f[0][d], g[0][d - X[v]] + dp[0][v]);
        f[1][d] = min(f[1][d], g[1][d - X[v]] + dp[1][v]);
      }
      if (d >= dp[1][v]) f[0][d] = min(f[0][d], g[0][d - dp[1][v]] + X[v]);
      if (d >= dp[0][v]) f[1][d] = min(f[1][d], g[1][d - dp[0][v]] + X[v]);
    }
    int min0 = INF, min1 = INF;
    for (int d = 0; d <= X[u]; ++d) {
      g[0][d] = f[0][d];
      min0 = min(min0, g[0][d]);
      g[1][d] = f[1][d];
      min1 = min(min1, g[1][d]);
      f[0][d] = INF;
      f[1][d] = INF;
    }
    dp[0][u] = min0;
    dp[1][u] = min1;
    if (min0 == INF && min1 == INF) {
      cout << u << " " << v << endl;
      puts("IMPOSSIBLE");
      exit(0);
    }
  }
}
void solve() {
  fill_n(&f[0][0], 2 * maxM, INF);
  dfs(1, 0);
  puts("POSSIBLE");
}
int main() {
  openFile();
  enter();
  solve();
  return 0;
}
