#include <bits/stdc++.h>
using namespace std;
const int INF = (1LL << 30);
const long long LLINF = (1LL << 60);
const double PI = 3.14159265359;
const double EPS = 1e-12;
const int MOD = 1000000007;
template <typename T>
T &chmin(T &a, const T &b) {
  return a = min(a, b);
}
template <typename T>
T &chmax(T &a, const T &b) {
  return a = max(a, b);
}
int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};
vector<int> g[1010];
int dp[1010], dp2[1010][5010], x[1010];
void dfs(int num) {
  if (g[num].size() == 0) {
    dp[num] = 0;
    return;
  }
  for (int i : g[num]) dfs(i);
  memset(dp2, 0x3f, sizeof(dp2));
  dp2[0][0] = 0;
  for (long long i = (long long)0; i < (long long)g[num].size(); ++i)
    for (long long j = (long long)0; j < (long long)5001; ++j) {
      if (j >= x[g[num][i]])
        chmin(dp2[i + 1][j], dp2[i][j - x[g[num][i]]] + dp[g[num][i]]);
      if (j >= dp[g[num][i]])
        chmin(dp2[i + 1][j], dp2[i][j - dp[g[num][i]]] + x[g[num][i]]);
    }
  int ret = 0x3f3f3f3f;
  for (long long i = (long long)0; i < (long long)x[num] + 1; ++i)
    chmin(ret, dp2[g[num].size()][i]);
  dp[num] = ret;
  if (dp[num] == 0x3f3f3f3f) {
    cout << "IMPOSSIBLE" << endl;
    exit(-1);
  }
}
signed main(void) {
  int n;
  cin >> n;
  for (long long i = (long long)0; i < (long long)n - 1; ++i) {
    int p;
    cin >> p;
    p--;
    g[p].push_back(i + 1);
  }
  for (long long i = (long long)0; i < (long long)n; ++i) cin >> x[i];
  dfs(0);
  cout << "POSSIBLE" << endl;
  return 0;
}
