#include <bits/stdc++.h>
using namespace std;
const int N = 1e3 + 7;
const int M = 5e3 + 7;
int x[N];
vector<int> g[N];
int dp[N];
bitset<2 * M> c;
void dfs(int cur) {
  c.reset();
  c[0] = 1;
  int s = 0;
  for (auto t : g[cur]) {
    dfs(t);
    c = (c << x[t]) | (c << dp[t]);
    s += x[t];
    s += dp[t];
  }
  for (int i = x[cur]; i >= 0; i--) {
    if (c[i]) {
      dp[cur] = s - i;
      return;
    }
  }
  cout << "IMPOSSIBLE\n";
  exit(0);
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  for (int i = 1; i < n; i++) {
    int p;
    cin >> p;
    p--;
    g[p].push_back(i);
  }
  for (int i = 0; i < n; i++) {
    cin >> x[i];
  }
  dfs(0);
  cout << "POSSIBLE\n";
}
