#include <bits/stdc++.h>
using namespace std;
int N;
int p[1001];
int A[1001];
vector<int> adj[1001];
int dp[1001];
int dp2[1001][501];
void dfs(int x) {
  dp[x] = 1e9;
  for (auto i : adj[x]) {
    dfs(i);
  }
  for (long long i = 0; i <= (long long)adj[x].size() - 1; i++) {
    for (long long j = 0; j <= (long long)A[x]; j++) {
      dp2[i][j] = 1e9;
      if (j == 0)
        dp2[i][j] = 0;
      else {
        if (j >= dp[adj[x][i]])
          dp2[i][j] =
              min(dp2[i][j], dp2[i - 1][j - dp[adj[x][i]]] + A[adj[x][i]]);
        if (j >= A[adj[x][i]])
          dp2[i][j] =
              min(dp2[i][j], dp2[i - 1][j - A[adj[x][i]]] + dp[adj[x][i]]);
      }
    }
  }
  if (adj[x].empty())
    dp[x] = 0;
  else
    dp[x] = dp2[adj[x].size() - 1][A[x]];
}
int main() {
  cin >> N;
  for (long long i = 2; i <= (long long)N; i++) {
    cin >> p[i];
    adj[p[i]].push_back(i);
  }
  for (long long i = 1; i <= (long long)N; i++) cin >> A[i];
  dfs(1);
  if (dp[1] == 1e9)
    cout << "IMPOSSIBLE";
  else
    cout << "POSSIBLE";
}
