#include <bits/stdc++.h>
using namespace std;
template <class T>
void chmin(T& a, const T& b) {
  if (a > b) a = b;
}
template <class T>
void chmax(T& a, const T& b) {
  if (a < b) a = b;
}
int dp[1010];
int N;
vector<int> g[1010];
int X[1010];
int dp2[1010][5010];
bool flag = false;
int rec(int v) {
  if (flag) return -1;
  int sum = 0;
  for (int i = 0; i < g[v].size(); i++) {
    int u = g[v][i];
    rec(u);
    sum += X[u] + dp[u];
  }
  for (int i = 0; i <= g[v].size(); i++) {
    for (int j = 0; j <= 5000; j++) {
      dp2[i][j] = 0;
    }
  }
  dp2[0][0] = 1;
  for (int i = 0; i < g[v].size(); i++) {
    int u = g[v][i];
    for (int j = 0; j <= 5000; j++) {
      if (j >= X[u] && dp2[i][j - X[u]] == 1) dp2[i + 1][j] = 1;
      if (j >= dp[u] && dp2[i][j - dp[u]] == 1) dp2[i + 1][j] = 1;
    }
  }
  int ret = -1;
  for (int i = 0; i <= X[v]; i++)
    if (dp2[(int)g[v].size()][i] == 1) ret = i;
  if (ret == -1) {
    flag = true;
    return -1;
  }
  return dp[v] = sum - ret;
}
int main() {
  scanf("%d", &N);
  for (int i = 1; i < N; i++) {
    int par;
    scanf("%d", &par);
    par--;
    g[par].push_back(i);
  }
  for (int i = 0; i < N; i++) scanf("%d", &X[i]);
  if (rec(0) == -1)
    printf("IMPOSSIBLE\n");
  else
    printf("POSSIBLE\n");
  return 0;
}
