#include <bits/stdc++.h>
using namespace std;
int n, x, t;
int val[305], cur[305], en[305];
int mn[1005];
bool dp[1005][5005];
vector<int> v[305];
void dfs(int node) {
  for (int i : v[node]) dfs(i);
  dp[0][0] = 1;
  int sum = 0;
  for (int i = 1; i <= ((int)v[node].size()); i++) {
    int cur = v[node][i - 1];
    sum += val[cur] + mn[cur];
    for (int j = 0; j <= 5000; j++) {
      dp[i][j] = 0;
      if (j - mn[cur] >= 0) {
        dp[i][j] |= dp[i - 1][j - mn[cur]];
      }
      if (j - val[cur] >= 0) {
        dp[i][j] |= dp[i - 1][j - val[cur]];
      }
    }
  }
  for (int i = val[node]; i >= 0; i--) {
    if (dp[((int)v[node].size())][i]) {
      mn[node] = sum - i;
      return;
    }
  }
  cout << "IMPOSSIBLE";
  exit(0);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 2; i <= n; i++) {
    cin >> x;
    v[x].push_back(i);
  }
  for (int i = 1; i <= n; i++) cin >> val[i];
  dfs(1);
  cout << "POSSIBLE";
}
