#include <bits/stdc++.h>
using namespace std;
int n, a[5005], b[5005], dp[5005][5005];
vector<int> g[5005];
void dfs(int node) {
  int sz = g[node].size();
  for (int i = 1; i < sz; i++) dfs(g[node][i]);
  for (int i = 1; i < 5005; i++) dp[0][i] = 1000000007;
  for (int i = 1; i < sz; i++)
    for (int j = 0; j < 5005; j++) {
      dp[i][j] = 1000000007;
      if (j >= b[g[node][i]])
        dp[i][j] = dp[i - 1][j - b[g[node][i]]] + a[g[node][i]];
      if (j >= a[g[node][i]])
        dp[i][j] = min(dp[i][j], dp[i][j - a[g[node][i]]] + b[g[node][i]]);
    }
  int mn = 1000000007;
  for (int i = 0; i <= a[node]; i++) mn = min(mn, dp[sz - 1][i]);
  if (mn >= 1000000007) {
    printf("IMPOSSIBLE\n");
    exit(0);
  }
  b[node] = mn;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) g[i].push_back(0);
  for (int i = 2; i <= n; i++) {
    int x;
    scanf("%d", &x);
    g[x].push_back(i);
  }
  for (int i = 1; i <= n; i++) scanf("%d", a + i);
  dfs(1);
  printf("POSSIBLE\n");
  return 0;
}
