#include <bits/stdc++.h>
using namespace std;
const int INF = (int)1e9 + 123;
const long long LINF = (long long)1e18 + 123;
const long double EPS = (long double)1e-8;
const long long MOD = (long long)1e9 + 7;
long long power(long long x, long long y, long long mod) {
  if (y == 0) {
    return 1;
  }
  if (y & 1) {
    return power(x, y - 1, mod) * x % mod;
  } else {
    long long tmp = power(x, y / 2, mod);
    return tmp * tmp % mod;
  }
}
inline void add(long long &x, long long y, long long mod) {
  x += y;
  if (x >= mod) x -= mod;
  if (x < 0) x += mod;
}
inline long long sum(long long x, long long y, long long mod) {
  add(x, y, mod);
  return x;
}
template <typename A, typename B>
inline bool mini(A &x, const B &y) {
  if (y < x) {
    x = y;
    return true;
  }
  return false;
}
template <typename A, typename B>
inline bool maxi(A &x, const B &y) {
  if (y > x) {
    x = y;
    return true;
  }
  return false;
}
template <typename T>
inline void read(T first, T last) {
  while (first != last) {
    cin >> *(first++);
  }
}
template <typename T>
inline void print(T first, T last) {
  while (first != last) {
    cout << *(first++) << " ";
  }
  cout << "\n";
}
void run();
int main() {
  if (strlen("")) {
    freopen(
        ""
        ".in",
        "r", stdin);
    freopen(
        ""
        ".out",
        "w", stdout);
  }
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cout << fixed << setprecision(15);
  run();
  return 0;
}
const int N = 1005;
const int K = 5005;
int n;
vector<int> g[N];
int x[N], dp[N];
int cur[K], nxt[K];
void dfs(int v) {
  fill(cur, cur + K, INF);
  cur[0] = 0;
  for (int u : g[v]) {
    dfs(u);
    fill(nxt, nxt + K, INF);
    for (auto i = 0; i < x[v] + 1; i++) {
      if (i + x[u] <= x[v]) {
        mini(nxt[i + x[u]], cur[i] + dp[u]);
      }
      if (i + dp[u] <= dp[v]) {
        mini(nxt[i + dp[u]], cur[i] + x[u]);
      }
    }
    swap(nxt, cur);
  }
  dp[v] = INF;
  for (auto i = 0; i < x[v] + 1; i++) {
    if (cur[i] == INF) {
      continue;
    }
    mini(dp[v], cur[i]);
  }
  if (dp[v] == INF) {
    cout << "IMPOSSIBLE\n";
    exit(0);
  }
  assert(dp[v] < N * K);
}
void run() {
  cin >> n;
  for (auto i = 2; i < n + 1; i++) {
    int p;
    cin >> p;
    g[p].push_back(i);
  }
  for (auto i = 1; i < n + 1; i++) {
    cin >> x[i];
  }
  dfs(1);
  cout << "POSSIBLE\n";
}
