#include <bits/stdc++.h>

using namespace std;

int main() {
   ios_base::sync_with_stdio(false);
   int N;
   cin >> N;
   vector<vector<int>> adj(N);
   for (int i = 1; i < N; ++i) {
      int par;
      cin >> par; --par;
      adj[par].emplace_back(i);
   }
   vector<int> X(N), Y(N);
   for (int i = 0; i < N; ++i) {
      cin >> X[i];
   }
   for (int v = N - 1; v >= 0; --v) {
      int sum = 0;
      int rem = X[v];
      vector<int> deltas;
      for (int u : adj[v]) {
         sum += X[u] + Y[u];
         rem -= min(X[u], Y[u]);
         deltas.emplace_back(abs(X[u] - Y[u]));
      }
      if (rem < 0) {
         cout << "IMPOSSIBLE\n";
         return 0;
      }
      vector<bool> dp(rem + 1);
      dp[rem] = true;
      for (int val : deltas) {
         for (int i = val; i <= rem; ++i) {
            if (dp[i]) dp[i - val] = true;
         }
      }
      int add = 0;
      while (!dp[add]) add++;
      Y[v] = sum + add - X[v];
   }
   cout << "POSSIBLE\n";
   return 0;
}
