#include <bits/stdc++.h>
using namespace std;
template <class T>
using vv = vector<vector<T>>;
template <class T>
inline bool MX(T &l, const T &r) {
  return l < r ? l = r, 1 : 0;
}
template <class T>
inline bool MN(T &l, const T &r) {
  return l > r ? l = r, 1 : 0;
}
const long long MOD = 1e9 + 7;
const int INF = 0x3fffffff;
int N;
vector<int> es[114514];
int first[114514];
int W[114514];
int dfs(int v) {
  int M = es[v].size();
  vector<int> dp[2];
  for (int(i) = 0; (i) < (2); ++(i)) dp[i].resize(5001);
  int src = 0;
  int dst = 1;
  dp[src][0] = 0;
  for (int u : es[v]) {
    int w = dfs(u);
    fill((dp[dst]).begin(), (dp[dst]).end(), INF);
    for (int(i) = 0; (i) < (5001); ++(i)) {
      if (i + w < 5001)
        dp[dst][i + w] = min(dp[dst][i + w], dp[src][i] + first[u]);
      if (i + first[u] < 5001)
        dp[dst][i + first[u]] = min(dp[dst][i + first[u]], dp[src][i] + w);
    }
    swap(src, dst);
  }
  for (int(i) = 0; (i) < (5001); ++(i)) {
    if (dp[src][i] <= first[v]) return i;
  }
  puts("IMPOSSIBLE");
  exit(0);
}
int main() {
  scanf("%d", &N);
  for (int(i) = 1; (i) < (N); ++(i)) {
    int p;
    scanf("%d", &p);
    --p;
    es[p].emplace_back(i);
  }
  for (int(i) = 0; (i) < (N); ++(i)) {
    scanf("%d", &first[i]);
  }
  dfs(0);
  puts("POSSIBLE");
}
