#include <bits/stdc++.h>
using std::min;
const int N = 1010, Inf = 1e9 + 7;
struct Edge {
  int to, next;
} way[N];
int n, p[N], X[N], dp[N], g[N * 10], tot, num[N];
void Build(int a, int b) {
  way[++tot] = (Edge){b, num[a]};
  num[a] = tot;
}
void Init() {
  scanf("%d", &n);
  int f;
  for (int i = 2; i <= n; ++i) scanf("%d", &f), Build(f, i);
  for (int i = 1; i <= n; ++i) scanf("%d", &X[i]);
}
bool Dfs(int x) {
  if (!num[x]) return 1;
  for (int i = num[x]; i; i = way[i].next) {
    int v = way[i].to;
    if (!Dfs(v)) return 0;
  }
  for (int i = 0; i <= X[x]; ++i) g[i] = Inf;
  bool fl = 1;
  for (int i = num[x]; i; i = way[i].next) {
    int v = way[i].to;
    if (fl) {
      fl = 0;
      g[dp[v]] = min(g[dp[v]], X[v]);
      g[X[v]] = min(g[X[v]], dp[v]);
    } else
      for (int j = X[x]; j >= 0; --j) {
        g[j + dp[v]] = min(g[j + dp[v]], g[j] + X[v]);
        g[j + X[v]] = min(g[j + X[v]], g[j] + dp[v]);
      }
  }
  int ans = Inf;
  for (int i = 0; i <= X[x]; ++i)
    if (g[i] != Inf) ans = min(ans, g[i]);
  if (ans == Inf) return 0;
  dp[x] = ans;
  return 1;
}
void Solve() {
  if (Dfs(1))
    printf("POSSIBLE\n");
  else
    printf("IMPOSSIBLE\n");
}
int main() {
  Init();
  Solve();
  return 0;
}
