#include <bits/stdc++.h>
using namespace std;
template <typename T>
void get_int(T &x) {
  char t = getchar();
  bool neg = false;
  x = 0;
  for (; (t > '9' || t < '0') && t != '-'; t = getchar())
    ;
  if (t == '-') neg = true, t = getchar();
  for (; t <= '9' && t >= '0'; t = getchar()) x = x * 10 + t - '0';
  if (neg) x = -x;
}
template <typename T>
void print_int(T x) {
  if (x < 0) putchar('-'), x = -x;
  short a[20] = {}, sz = 0;
  while (x > 0) a[sz++] = x % 10, x /= 10;
  if (sz == 0) putchar('0');
  for (int i = sz - 1; i >= 0; i--) putchar('0' + a[i]);
}
const int inf = 0x3f3f3f3f;
const long long Linf = 1ll << 61;
const double pi = acos(-1.0);
vector<int> g[1111];
int p[1111], n, v[1111], sz[1111], dp[1111][2];
int mn[5555][1111];
void dfs(int x) {
  for (int i = 0; i < (int)g[x].size(); i++) dfs(g[x][i]);
  for (int i = 0; i < (int)g[x].size(); i++) {
    for (int j = 0; j <= 5000; j++) {
      mn[i + 1][j] = inf;
      if (j >= v[g[x][i]])
        mn[i + 1][j] =
            min(mn[i + 1][j], mn[i][j - v[g[x][i]]] + dp[g[x][i]][1]);
      if (j >= dp[g[x][i]][0])
        mn[i + 1][j] =
            min(mn[i + 1][j], mn[i][j - dp[g[x][i]][0]] + v[g[x][i]]);
    }
  }
  dp[x][0] = mn[(int)g[x].size()][v[x]];
  dp[x][1] = inf;
  for (int i = 0; i <= 5000; i++)
    if (mn[(int)g[x].size()][i] <= v[x]) dp[x][1] = min(dp[x][1], i);
}
int main() {
  get_int(n);
  for (int i = 2; i <= n; i++) {
    get_int(p[i]);
    g[p[i]].push_back(i);
  }
  for (int i = 1; i <= n; i++) get_int(v[i]);
  dfs(1);
  if (dp[1][0] < inf || dp[1][1] < inf)
    puts("POSSIBLE");
  else
    puts("IMPOSSIBLE");
  return 0;
}
