#include <bits/stdc++.h>
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
inline long long int rand(long long int x, long long int y) {
  ++y;
  return (rng() % (y - x)) + x;
}
string to_string(char c) {
  string second(1, c);
  return second;
}
string to_string(bool b) { return (b ? "true" : "false"); }
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
void degug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void degug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  degug_out(T...);
}
inline long long int gcd(long long int a, long long int b) {
  if (a > b) swap(a, b);
  if (a == 0) return b;
  return gcd(b % a, a);
}
long long int n, A[(1002)], dp[(1002)][5002], pdp[(1002)][5002];
vector<int> v[(1002)];
void no() {
  cout << "IMPOSSIBLE" << '\n';
  exit(0);
}
void dfs(long long int x, long long int p) {
  fill(dp[x], dp[x] + 5002, ((long long)1e18));
  bool first = 0;
  for (auto i : v[x])
    if (i != p) {
      dfs(i, x);
      long long int a = A[i], b = dp[i][A[i]];
      if (min(a, b) > A[x]) no();
      if (first == 0) {
        if (a <= A[x]) dp[x][a] = b;
        if (b <= A[x]) dp[x][b] = a;
      } else {
        for (long long int i = A[x]; i >= 0; --i) {
          if (i - a >= 0) dp[x][i] = min(dp[x][i], pdp[x][i - a] + b);
          if (i - b >= 0) dp[x][i] = min(dp[x][i], pdp[x][i - b] + a);
        }
      }
      first = 1;
      for (long long int i = 0; i < (long long int)A[x] + 1; ++i) {
        pdp[x][i] = dp[x][i];
      }
      fill(dp[x], dp[x] + 5002, ((long long)1e18));
    }
  for (long long int i = 0; i < (long long int)A[x] + 1; ++i) {
    dp[x][i] = pdp[x][i];
  }
  for (long long int i = 1; i < (long long int)A[x] + 1; ++i) {
    dp[x][i] = min(dp[x][i], dp[x][i - 1]);
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> n;
  for (long long int i = 2; i < (long long int)n + 1; ++i) {
    long long int a;
    cin >> a;
    v[i].push_back(a);
    v[a].push_back(i);
  }
  for (long long int i = 1; i < (long long int)n + 1; ++i) cin >> A[i];
  dfs(1, 1);
  cout << "POSSIBLE\n";
}
