#include <bits/stdc++.h>
using namespace std;
const int N = 1005, INF = 0x3f3f3f3f;
vector<int> V[N];
int f[N][5005], g[N], h[N];
int n;
void Dfs(int x) {
  int a, b;
  f[x][0] = 0;
  for (auto v : V[x]) {
    Dfs(v);
    a = min(g[v], h[v]);
    b = max(g[v], h[v]);
    for (int j = h[x]; j >= a; --j) {
      if (b > j)
        f[x][j] = f[x][j - a] + b;
      else
        f[x][j] = min(f[x][j - a] + b, f[x][j - b] + a);
    }
    for (int j = 0; j < a; ++j) f[x][j] = INF;
  }
  g[x] = f[x][0];
  for (int i = 0; i <= h[x]; ++i) g[x] = min(g[x], f[x][i]);
  if (g[x] == INF) puts("IMPOSSIBLE"), exit(0);
}
int main() {
  scanf("%d", &n);
  memset(f, 0x3f, sizeof f);
  for (int i = 2, j; i <= n; ++i) scanf("%d", &j), V[j].emplace_back(i);
  for (int i = 1; i <= n; ++i) scanf("%d", &h[i]);
  Dfs(1);
  return puts("POSSIBLE"), 0;
}
