#include <bits/stdc++.h>
using namespace std;
int n;
vector<int> g[1005];
int x[1005], y[1005];
bool dfs(int v) {
  int dp[10005];
  for (int j = 0; j <= 5000; j++) dp[j] = 10000;
  if (g[v].size() == 0) {
    return true;
  }
  for (int i = 0; i < g[v].size(); i++) {
    int u = g[v][i];
    if (!dfs(u)) return false;
    if (i == 0) {
      dp[x[u]] = y[u];
      dp[y[u]] = x[u];
    } else {
      for (int j = 0; j <= 5000; j++) {
        dp[j + x[u]] = min(dp[j + x[u]], dp[j] + y[u]);
        dp[j + x[u]] = min(dp[j + x[u]], dp[j] + y[u]);
      }
    }
  }
  y[v] = 10000;
  for (int i = 0; i <= x[v]; i++) {
    if (dp[i] != 10000) {
      y[v] = min(y[v], dp[i]);
    }
  }
  if (y[v] == 10000)
    return false;
  else
    return true;
}
int main(void) {
  cin >> n;
  for (int i = 1; i < n; i++) {
    int p;
    scanf("%d", &p);
    g[--p].push_back(i);
  }
  for (int i = 0; i < n; i++) scanf("%d", x + i);
  if (dfs(0))
    cout << "POSSIBLE\n";
  else
    cout << "IMPOSSIBLE\n";
}
