#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e3 + 7;
const int maxm = 5e3 + 7;
bool f[maxn];
bool dp[maxn][maxm];
vector<int> G[maxn];
int X[maxn];
int S[maxn];
vector<int> g;
void dfs(int x) {
  if (G[x].size() == 0) {
    S[x] = X[x];
    f[x] = true;
    return;
  }
  for (int y : G[x]) {
    dfs(y);
    S[x] += S[y];
  }
  g = G[x];
  for (int i = 0; i < maxm; i++) {
    int y = g[0];
    dp[0][i] = f[y] && ((X[y] <= i) || (S[y] - X[y] <= i));
  }
  int m = g.size() - 1;
  for (int i = 1; i <= m; i++) {
    int y = g[i];
    for (int j = 0; j < maxm; j++) {
      dp[i][j] = false;
      if (j >= X[y]) {
        dp[i][j] = dp[i][j] || dp[i - 1][j - X[y]];
      }
      if (j >= S[y] - X[y]) {
        dp[i][j] = dp[i][j] || dp[i - 1][j - S[y] + X[y]];
      }
      dp[i][j] &= f[y];
    }
  }
  f[x] = false;
  for (int i = 0; i < maxn; i++) f[x] |= dp[m][i];
  S[x] += X[x];
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 2; i <= n; i++) {
    int p;
    scanf("%d", &p);
    G[p].push_back(i);
  }
  for (int i = 1; i <= n; i++) {
    scanf("%d", &X[i]);
  }
  dfs(1);
  printf(f[1] ? "POSSIBLE" : "IMPOSSIBLE");
  printf("\n");
}
