#include <bits/stdc++.h>
using namespace std;
const int maxn = 1000 + 5;
vector<int> g[maxn];
int n;
int p[maxn], X[maxn];
const int maxX = 5000 + 5;
bool dp[maxn][maxX];
vector<int> val;
bool flag = false;
void dfs(int v, int fa) {
  if (g[v].size() == 1 && g[v][0] == fa) {
    dp[v][0] = true;
    dp[v][X[v]] = true;
    return;
  }
  for (int i = 0; i < (int)g[v].size(); i++) {
    int u = g[v][i];
    if (u != fa) {
      dfs(u, v);
    }
  }
  val.clear();
  for (int i = 0; i < (int)g[v].size(); i++) {
    int u = g[v][i];
    if (u != fa) {
      for (int j = 0; j < maxX; j++)
        if (dp[u][j]) val.push_back(j);
    }
  }
  dp[v][0] = true;
  for (int i = 0; i < maxX; i++) {
    for (int j = 0; j < (int)val.size(); j++) {
      int w = val[j];
      if (i >= w) dp[v][i] |= dp[v][i - w];
    }
  }
  if (v == 1) {
    for (int i = 1; i < X[v]; i++) {
      if (dp[v][i]) flag = true;
    }
    return;
  }
  dp[v][X[v]] = true;
}
int main() {
  scanf("%d", &n);
  for (int i = 2; i <= n; i++) {
    scanf("%d", &p[i]);
    g[p[i]].push_back(i);
    g[i].push_back(p[i]);
  }
  for (int i = 1; i <= n; i++) scanf("%d", &X[i]);
  dfs(1, -1);
  if (flag || n == 1)
    printf("POSSIBLE\n");
  else
    printf("IMPOSSIBLE\n");
  return 0;
}
