#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const long long LINF = 2e17;
const int INF = 1e9;
const int magic = 348;
const long double eps = 1e-15;
const double pi = 3.14159265;
inline int getint() {
  char ch;
  int res;
  bool f;
  while (!isdigit(ch = getchar()) && ch != '-') {
  }
  if (ch == '-')
    f = false, res = 0;
  else
    f = true, res = ch - '0';
  while (isdigit(ch = getchar())) res = res * 10 + ch - '0';
  return f ? res : -res;
}
int p[1048], n;
int dp[1048], son[1048][5048];
int head[100048], nxt[200048], to[200048], tot = 1;
inline void addedge(int s, int t) {
  to[++tot] = t;
  nxt[tot] = head[s];
  head[s] = tot;
}
inline void dfs(int cur) {
  int i, j, second, cc = 0;
  for (i = 0; i <= 5000; i++) son[0][i] = 0;
  for (i = head[cur]; i; i = nxt[i]) {
    second = to[i];
    dfs(second);
    cc++;
    for (j = 0; j <= 5000; j++) son[cc][j] = INF;
    for (j = 0; j <= 5000; j++) {
      if (j >= p[second])
        son[cc][j] = min(son[cc][j], son[cc - 1][j - p[second]] + dp[second]);
      if (j >= dp[second])
        son[cc][j] = min(son[cc][j], son[cc - 1][j - dp[second]] + p[second]);
    }
  }
  dp[cur] = son[cc][p[cur]];
}
int main() {
  int i, first;
  n = getint();
  for (i = 2; i <= n; i++) first = getint(), addedge(first, i);
  for (i = 1; i <= n; i++) p[i] = getint();
  dfs(1);
  if (dp[1] < INF)
    printf("POSSIBLE\n");
  else
    printf("IMPOSSIBLE\n");
  return 0;
}
