#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("fast-math")
using namespace std;
const long double EPS = 1e-5;
const long double EPS2 = 1e-12;
const long double PI = acos(-1);
int mod = (int)998244353;
const int MOD7 = 1000000007;
const int MOD9 = 1000000009;
const int a228 = 18;
const int inf = 1e9;
mt19937 rnd(time(0));
const long long kekmod = 1791791791;
const long long bestmod = 1148822869;
int n;
const int MAXN = 1001;
vector<int> g[MAXN];
int sz[MAXN];
int w[MAXN];
void dfs(int v) {
  vector<pair<int, int>> wts;
  vector<int> dp(5001);
  vector<int> ndp(5001);
  for (int i : g[v]) {
    dfs(i);
    sz[v] += w[i];
    wts.push_back({w[i], sz[i] - w[i]});
  }
  dp[0] = 1;
  for (int i = 0; i < wts.size(); ++i) {
    for (int j = 0; j < 5001; ++j) {
      if (!dp[j]) continue;
      int nw = j + wts[i].first;
      if (nw < 5001) ndp[nw] = 1;
      nw = j + wts[i].second;
      if (nw < 5001) ndp[nw] = 1;
    }
    swap(dp, ndp);
    ndp.assign(5001, 0);
  }
  bool ff = 0;
  for (int i = 0; i <= w[v]; ++i)
    if (dp[i]) ff = 1;
  if (!ff) {
    cout << "IMPOSSIBLE";
    system("pause");
    exit(0);
  }
  sz[v] += w[v];
}
signed main() {
  ios_base::sync_with_stdio(0);
  cout.tie(0);
  cin.tie(0);
  srand(time(NULL));
  cin >> n;
  for (int i = 2; i <= n; ++i) {
    int x;
    cin >> x;
    g[x].push_back(i);
  }
  for (int i = 1; i <= n; ++i) cin >> w[i];
  dfs(1);
  cout << "POSSIBLE";
  system("pause");
}
