#include <bits/stdc++.h>
using namespace std;
const int MAXN = 5e3 + 5;
const int LIM = 5e3;
const int oo = 0x3f3f3f3f;
int N, fa[MAXN], f[MAXN], a[MAXN], g[MAXN][MAXN];
bool isleaf[MAXN], vis[MAXN];
namespace solution {
void Prepare() {
  scanf("%d", &N);
  for (int i = 2; i <= N; i++) scanf("%d", &fa[i]);
  for (int i = 1; i <= N; i++) isleaf[i] = 1;
  for (int i = 1; i <= N; i++) isleaf[fa[i]] = 0;
  for (int i = 1; i <= N; i++) scanf("%d", &a[i]);
  for (int i = 1; i <= N; i++) f[i] = oo;
  for (int i = 1; i <= N; i++)
    for (int j = 0; j <= 5000; j++) g[i][j] = oo;
  for (int i = 1; i <= N; i++)
    if (isleaf[i]) g[i][0] = 0;
}
void Solve() {
  for (int node = N; node >= 1; node--) {
    for (int i = 0; i <= a[node]; i++) f[node] = min(f[node], g[node][i]);
    if (!vis[fa[node]]) {
      vis[fa[node]] = 1;
      if (f[node] <= a[fa[node]])
        g[fa[node]][f[node]] = min(g[fa[node]][f[node]], a[node]);
      if (a[node] <= a[fa[node]])
        g[fa[node]][a[node]] = min(g[fa[node]][a[node]], f[node]);
    } else {
      for (int i = a[fa[node]]; i >= 0; i--) {
        int cur = oo;
        if (a[node] <= i) cur = min(cur, g[fa[node]][i - a[node]] + f[node]);
        if (f[node] <= i) cur = min(cur, g[fa[node]][i - f[node]] + a[node]);
        g[node][i] = cur;
      }
    }
  }
  puts(f[1] == oo ? "IMPOSSIBLE" : "POSSIBLE");
}
}  // namespace solution
int main() {
  using namespace solution;
  Prepare();
  Solve();
  return 0;
}
