#include <bits/stdc++.h>
using namespace std;
struct edge {
  int r, nxt;
} e[1100 << 1];
int dp[1100][2], head[1100], esz, val[1100], mx, n, f[2][1100 * 5],
    g[2][1100 * 5];
void addedge(int u, int v) {
  e[++esz].r = v;
  e[esz].nxt = head[u];
  head[u] = esz;
}
void solve(int u) {
  for (int t = head[u]; t; t = e[t].nxt) solve(e[t].r);
  int p = 0, np = 1;
  for (int i = 0; i <= mx; ++i)
    f[np][i] = g[np][i] = 0, f[p][i] = g[p][i] = 1000000007;
  for (int t = head[u]; t; t = e[t].nxt, swap(p, np))
    for (int i = mx; i >= 0; --i) {
      if (i >= val[e[t].r])
        f[p][i] = min(f[p][i], f[np][i - val[e[t].r]] + dp[e[t].r][0]);
      if (i >= dp[e[t].r][1])
        g[p][i] = min(g[p][i], g[np][i - dp[e[t].r][1]] + val[e[t].r]);
      if (i >= val[e[t].r])
        f[p][i] = min(f[p][i], f[np][i - val[e[t].r]] + dp[e[t].r][1]);
      if (i >= dp[e[t].r][0])
        g[p][i] = min(g[p][i], g[np][i - dp[e[t].r][0]] + val[e[t].r]);
      f[np][i] = g[np][i] = 1000000007;
    }
  dp[u][0] = f[np][val[u]];
  dp[u][1] = g[np][val[u]];
}
int main() {
  scanf("%d", &n);
  for (int i = 2, f; i <= n; ++i) scanf("%d", &f), addedge(f, i);
  for (int i = 1; i <= n; ++i) scanf("%d", &val[i]), mx = max(mx, val[i]);
  solve(1);
  if (dp[1][0] == 1000000007 && dp[1][1] == 1000000007)
    puts("IMPOSSIBLE");
  else
    puts("POSSIBLE");
}
