#include <bits/stdc++.h>
using namespace std;
inline void down(int &x, const int &y) {
  if (x > y) {
    x = y;
  }
}
int n;
struct edge {
  int y, nex;
} a[2003];
int len, fir[1003];
inline void ins(const int x, const int y) {
  a[++len] = (edge){y, fir[x]};
  fir[x] = len;
}
int f[1003], w[1003], g[2][5003];
inline void clear(const int now) {
  for (int i = 0; i <= 5000; i++) {
    g[now][i] = 1e9;
  }
}
bool dp(const int x) {
  if (!fir[x]) {
    f[x] = 0;
    return 1;
  }
  int now = 1;
  clear(1), g[1][0] = 0;
  for (int k = fir[x], y = a[k].y; k; k = a[k].nex, y = a[k].y) {
    if (!dp(y)) {
      return 0;
    }
    now = !now;
    clear(now);
    for (int i = 0; i <= w[x]; i++) {
      if (i >= w[y]) {
        down(g[now][i], g[!now][i - w[y]] + f[y]);
      }
      if (i >= f[y]) {
        down(g[now][i], g[!now][i - f[y]] + w[y]);
      }
    }
  }
  for (int i = 0; i <= w[x]; i++) {
    down(f[x], g[now][i]);
  }
  if (f[x] == 1e9) {
    return 0;
  } else {
    return 1;
  }
}
int main() {
  cin >> n;
  for (int i = 2; i <= n; i++) {
    int x;
    cin >> x;
    ins(x, i);
  }
  for (int i = 1; i <= n; i++) {
    cin >> w[i];
  }
  if (!dp(1)) {
    cout << "IMPOSSIBLE" << endl;
  } else {
    cout << "POSSIBLE" << endl;
  }
  return 0;
}
