#include <bits/stdc++.h>
using namespace std;
const int N = 1010;
int n, fa[N], x[N], black[N], white[N];
vector<int> e[N];
int dp[2][N * 10], a = 0, b = 1;
int main() {
  scanf("%d", &n);
  for (int i = 2; i <= n; i++) scanf("%d", &fa[i]), e[fa[i]].push_back(i);
  for (int i = 1; i <= n; i++) scanf("%d", &x[i]);
  for (int v = n; v; v--) {
    for (int i = 1; i <= x[v]; i++) dp[a][i] = 1e9;
    dp[a][0] = 0;
    for (int i = 0; i < e[v].size(); i++, swap(a, b)) {
      int u = e[v][i];
      for (int i = 0; i <= x[v]; i++) dp[b][i] = 1e9;
      for (int i = x[v]; i >= 0; i--) {
        dp[b][i + x[u]] = min(dp[b][i + x[u]], dp[a][i] + black[u]);
        dp[b][i + white[u]] = min(dp[b][i + white[u]], dp[a][i] + x[u]);
      }
    }
    black[v] = 1e9;
    for (int i = 0; i <= x[v]; i++) black[v] = min(black[v], dp[a][i]);
    for (int i = 1; i <= x[v]; i++) dp[a][i] = 1e9;
    dp[a][0] = 0;
    for (int i = 0; i < e[v].size(); i++, swap(a, b)) {
      int u = e[v][i];
      for (int i = 0; i <= x[v]; i++) dp[b][i] = 1e9;
      for (int i = x[v]; i >= 0; i--) {
        dp[b][i + black[u]] = min(dp[b][i + black[u]], dp[a][i] + x[u]);
        dp[b][i + x[u]] = min(dp[b][i + x[u]], dp[a][i] + white[u]);
      }
    }
    white[v] = 1e9;
    for (int i = 0; i <= x[v]; i++) white[v] = min(white[v], dp[a][i]);
    if (black[v] > 1e8 && white[v] > 1e8) return puts("IMPOSSIBLE"), 0;
  }
  puts("POSSIBLE");
  return 0;
}
