#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <cmath>
#include <iomanip>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cassert>
#include <cstring>
#include <climits>

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> V;
typedef map<int, int> M;

constexpr ll INF = 1e18;
constexpr ll MOD = 1e9 + 7;
constexpr double PI = 3.14159265358979323846;
constexpr int dx[] = {0, 0, 1, -1};
constexpr int dy[] = {1, -1, 0, 0};

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);

    int n, p[1010], x[1010];
    cin >> n;
    REP(i, n - 1)
    cin >> p[i + 2];
    REP(i, n)
    cin >> x[i + 1];

    p[1] = 0;

    V g[1010];
    int cn[1010];
    memset(cn, 0, sizeof(cn));
    REP(i, n - 1)
    {
        g[p[i + 2]].push_back(i + 2);
        cn[p[i + 2]]++;
    }

    V s;

    while (true)
    {
        bool ok = true;
        for (int i = 1; i <= n; i++)
        {
            if (cn[i] == 0)
            {
                cn[i]--;
                cn[p[i]]--;

                s.push_back(i);
                ok = false;
                break;
            }
        }

        if (ok)
            break;
    }

    int dp[1010];

    for (int i : s)
    {
        int d[1010][5050];

        memset(d, -1, sizeof(d));

        for (int j = 0; j <= x[i]; j++)
            d[0][j] = 0;

        int sum = 0;

        for (int j = 0; j < g[i].size(); j++)
        {
            sum += x[g[i][j]] + dp[g[i][j]];
            for (int k = 0; k <= x[i]; k++)
            {
                bool check = false;
                if (k - x[g[i][j]] >= 0 && d[j][k - x[g[i][j]]] >= 0)
                    d[j + 1][k] = max(d[j + 1][k], x[g[i][j]] + d[j][k - x[g[i][j]]]), check = true;
                if (k - dp[g[i][j]] >= 0 && d[k - dp[g[i][j]]] >= 0)
                    d[j + 1][k] = max(d[j + 1][k], dp[g[i][j]] + d[j][k - dp[g[i][j]]]), check = true;
            }
        }

        if (d[g[i].size()][x[i]] < 0)
        {
            cout << "IMPOSSIBLE" << endl;
            return 0;
        }
        dp[i] = sum - d[g[i].size()][x[i]];
    }

    cout << "POSSIBLE" << endl;

    return 0;
}