#include <bits/stdc++.h>
using namespace std;
const int INF = 1000000007;
int n, X[1005];
vector<int> edge[1005];
pair<int, int> dp[1005];
bool possible;
void dfs(int cur) {
  int dp2[n + 1][X[cur] + 1];
  fill(dp2[0], dp2[n + 1], INF);
  dp2[0][0] = 0;
  int sz = edge[cur].size();
  for (int i = 0; i < sz; i++) {
    int child = edge[cur][i];
    dfs(child);
    int x = dp[child].first;
    int y = dp[child].second;
    for (int j = 0; j <= X[cur]; j++) {
      if (dp2[i][j] == INF) continue;
      if (j + x <= X[cur]) {
        dp2[i + 1][j + x] = dp2[i][j] + y;
      }
      if (j + y <= X[cur]) {
        dp2[i + 1][j + y] = dp2[i][j] + x;
      }
    }
  }
  for (int i = X[cur]; i >= 0; i--) {
    if (dp2[sz][i] < INF) {
      dp[cur] = pair<int, int>(X[cur], dp2[sz][i]);
      return;
    }
  }
  possible = false;
}
int main() {
  cin >> n;
  for (int i = 1; i < n; i++) {
    int p;
    cin >> p;
    p--;
    edge[p].push_back(i);
  }
  for (int i = 0; i < n; i++) {
    cin >> X[i];
  }
  possible = true;
  dfs(0);
  if (possible) {
    cout << "POSSIBLE\n";
  } else {
    cout << "IMPOSSIBLE\n";
  }
  return 0;
}
