#include <bits/stdc++.h>
using namespace std;
const int N = 5e3 + 10, INF = N;
int n, a[N], f[N], dp[N];
vector<int> g[N];
void dfs(int first) {
  for (int second : g[first]) dfs(second);
  for (int i = 0; i <= a[first]; ++i) dp[i] = INF;
  dp[0] = 0;
  for (int second : g[first]) {
    if (a[first] >= f[second]) {
      for (int i = a[first]; i >= a[second]; --i)
        dp[i] = min(dp[i - a[second]] + f[second], dp[i] + a[second]);
      for (int i = a[second] - 1; i >= 0; --i) dp[i] = dp[i] + a[second];
    } else {
      for (int i = a[first]; i >= a[second]; --i)
        dp[i] = dp[i - a[second]] + f[second];
      for (int i = a[second] - 1; i >= 0; --i) dp[i] = INF;
    }
  }
  f[first] = dp[0];
  for (int i = 1; i <= a[first]; ++i) f[first] = min(f[first], dp[i]);
}
int main() {
  scanf("%d", &n);
  for (int i = 2; i <= n; ++i) {
    int first;
    scanf("%d", &first);
    g[first].push_back(i);
  }
  for (int i = 1; i <= n; ++i) scanf("%d", a + i);
  dfs(1);
  puts(f[1] >= INF ? "IMPOSSIBLE" : "POSSIBLE");
}
