#include <bits/stdc++.h>
using namespace std;
#define FastIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long

int32_t main()
{
	int n,sum=0,cnt=0,col=1;
	cin>>n;
	int b[n+1],a[n+1],h[n+1]={};
	for(int i=1; i<=n; i++)
	{
		cin>>a[i];
		a[i]=n-a[i];
		if(h[a[i]]==0)
		{
			sum+=a[i];
			h[a[i]]+=1;
		}
	}
	for(int i=1; i<=n; i++)
		h[i]=0;

	{
		for(int i=1; i<=n; i++)
		{
			cnt=a[i];
			int j=i,curr=a[i],visit=0;
			if(h[i]==1)
			    continue;
			while(cnt>0 && j<=n && h[j]==0)
			{
				if(a[j]==curr)
				{
				    visit=1;
					b[j]=col;
					h[j]=1;
					cnt--;
				}
				j++;
			}
//			cout<<cnt<<" ";
			if(cnt>0)
			{
			    cout<<"Impossible";
			    return 0;
			}
			if(visit==1)
    			col++;
		}

        cout<<"Possible\n";
		for(int i=1; i<=n; i++)
			cout<<b[i]<<" ";
	}

}


#include <bits/stdc++.h>
using namespace std;
#define int long long
#define FastIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

signed main()
{
    FastIO;
    int n;
    cin>>n;
    int a[n],b[n+1], ans=1;
    for(int i=0; i<n; i++)
    	cin>>a[i];

    sort(a, a+n);
    reverse(a, a+n);
	b[n] = -1;
	int c = 1;
    for(int i=0; i<n; )
    {
    	int t = n-a[i];
    	int f = a[i];
    	while(t--)
    	{
    		if(a[i] != f)
    		{
    			ans = 0;
    			break;
    		}
    		b[i] = c;
    		i++;
    	}
    	c++;
    }

    if(ans == 0)
    	cout<<"Impossible";
    else
    {
    	cout<<"Possible\n";
    	for(int i=0; i<n; i++)
    		cout<<b[i]<<" ";
    }
}


#include <bits/stdc++.h>
using namespace std;
#define int long long
#define FastIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

signed main()
{
    FastIO;
    int n;
    cin>>n;
    int a[n],b[n+1], ans=1;
    for(int i=0; i<n; i++)
    	cin>>a[i];

    sort(a, a+n);
	b[n] = -1;
	int c = 1;
    for(int i=0; i<n; )
    {
    	int t = n-a[i];
    	int f = a[i];
    	while(t--)
    	{
    		if(a[i] != f)
    		{
    			ans = 0;
    			break;
    		}
    		b[i] = c;
    		i++;
    	}
    	c++;
    }

    if(ans == 0)
    	cout<<"Impossible";
    else
    {
    	cout<<"Possible\n";
    	for(int i=0; i<n; i++)
    		cout<<b[i]<<" ";
    }
}


#include <bits/stdc++.h>
using namespace std;
#define FastIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long

vector <int> ans;
map <int, int> mp;

int32_t main()
{
    int n,a[100001];
    cin>>n;
    for(int i=0; i<n; i++)
    {
        cin>>a[i];
        mp[a[i]]+=1;
    }

    sort(a, a+n);
    int col=1;
    for(int i=0; i<n; i++)
    {
        int c=n-a[i];
//        cout<<c<<" "<<mp[a[i]]<<"\n";
        if(c<=mp[a[i]])
        {   while(c--)
            {
                ans.push_back(col);
                mp[a[i]]--;
                i++;
            }
            i=i-1;
            col++;
        }
        else
        {
            cout<<"Impossible";
            return 0;
        }
    }

    cout<<"Possible\n";
    for(int i=0; i<ans.size(); i++)
        cout<<ans[i]<<" ";
}


#include<bits/stdc++.h>
using namespace std;

#define ll long long
#define ld long double
#define pb push_back
#define ff first
#define ss second
#define mp make_pair
#define ins insert
#define sb substr
#define con continue
#define ub upper_bound
#define lb lower_bound
#define pll pair<ll,ll>
#define pld pair<ld,ld>

ll power(ll x, ll y);
ll mpower(ll x, ll y, ll p);
bool isPrime(ll n);
ll const N=(ll)1e5;
vector<vector<ll> >g(N);
ll visited[N]={0};
ll restri[N]={0};
ll ans=0;

void dfs(ll v,ll a,ll c,ll m)
{

}

bool isPerfect(ll N)
    {
        if ((sqrt(N) - floor(sqrt(N))) != 0)
            return false;
        return true;
    }

int main()
{
            ios_base::sync_with_stdio(false);
            cin.tie(NULL);
            ll t,i,j,k,l,h,p,q,r,x,y,z,a,b,c,d,f,n,m,M=1000000007;

            t=1;

            while(t--)
            {
                    cin>>n;

                    ll arr[n],a[n]={0};

                    for(i=0;i<n;i++)
                    {
                        cin>>arr[i];
                        a[arr[i]]++;
                    }

                    p=0;
                    for(i=0;i<n;i++)
                    {
                        if(a[i])
                            p+=i;
                    }

                    if(p>n || a[0])
                    {
                        cout<<"Impossible"<<endl;
                        continue;
                    }

                    c=0;
                    ll ans[n]={0};
                    map<ll,ll>fre;

                    for(i=0;i<n;i++)
                    {
                        if(!fre[arr[i]])
                        {
                            c++;
                            fre[arr[i]]=c;
                            ans[i]=c;
                        }
                        else
                        {
                            ans[i]=fre[arr[i]];
                        }
                    }

                    cout<<"Possible"<<endl;

                    for(i=0;i<n;i++)
                        cout<<ans[i]<<" ";

                    cout<<endl;

            }

}

ll mpower(ll x, ll y, ll p){
    ll res = 1;
    x = x % p;
    while(y > 0){
        if(y & 1) res = (res*x) % p;
        y = y>>1;
        x = (x*x) % p;
    }
    return res;
}

ll power(ll x, ll y){
    ll res = 1;
    while (y > 0){
        if (y & 1) res = res*x;
        y = y>>1;
        x = x*x;
    }
    return res;
}
bool isPrime(ll n){
    if (n <= 1)  return false;
    if (n <= 3)  return true;
    if (n%2 == 0 || n%3 == 0) return false;
    ll p=sqrt(n);
    for(int i=5;i<=p;i=i+6)
        if (n%i == 0 || n%(i+2) == 0)
            return false;
    return true;
}


#include<bits/stdc++.h>
using namespace std;

#define ll long long
#define ld long double
#define pb push_back
#define ff first
#define ss second
#define mp make_pair
#define ins insert
#define sb substr
#define con continue
#define ub upper_bound
#define lb lower_bound
#define pll pair<ll,ll>
#define pld pair<ld,ld>

ll power(ll x, ll y);
ll mpower(ll x, ll y, ll p);
bool isPrime(ll n);
ll const N=(ll)1e5;
vector<vector<ll> >g(N);
ll visited[N]={0};
ll restri[N]={0};
ll ans=0;
bool prime[200001];

void dfs(ll v,ll a,ll c,ll m)
{

}

ll gcd(ll a,ll b)
{
    if(a==0)
        return b;
    return gcd(b%a,a);
}

bool isPerfect(ll N)
    {
        if ((sqrt(N) - floor(sqrt(N))) != 0)
            return false;
        return true;
    }

void SieveOfEratosthenes(ll n)
{
    memset(prime, true, sizeof(prime));

    for (ll p=2; p*p<=n; p++)
    {
        if (prime[p] == true)
        {
            for (ll i=p*p; i<=n; i += p)
                prime[i] = false;
        }
    }

}

int main()
{
            ios_base::sync_with_stdio(false);
            cin.tie(NULL);
            ll t,i,j,k,l,h,p,q,r,x,y,z,a,b,c,d,f,n,m,M=1000000007;

            t=1;

            while(t--)
            {
                    cin>>n;

                    ll arr[n];
                    vector<pll>di;

                    for(i=0;i<n;i++)
                    {
                        cin>>arr[i];
                        di.pb(mp(arr[i],i));
                    }

                    sort(di.begin(),di.end());

                    if(di[0].ff==0 && di[n-1].ff!=0)
                    {
                        cout<<"Impossible"<<endl;
                        continue;
                    }

                    else if(di[0].ff==0)
                    {
                        cout<<"Possible"<<endl;
                        for(i=0;i<n;i++)
                            cout<<"1"<<" ";

                        cout<<endl;
                        continue;
                    }

                    for(i=0;i<n;i++)
                    {
                        di[i].ff=n-di[i].ff;
                    }

                    ll ans[n]={0};

                    map<ll,ll>fre;
                    f=0;
                    for(i=0;i<n;i++)
                    {
                      //  cout<<(di[i].ff)<<" ";
                        fre[di[i].ff]++;
                    }
                   // cout<<endl;

                    sort(di.begin(),di.end());
                    for(auto it=fre.begin();it!=fre.end();it++)
                    {
                        i=it->first;
                        j=it->second;

                        if(j%i!=0)
                        {
                          //  cout<<i<<" "<<j<<endl;
                            f=1;
                            break;
                        }
                    }

                    if(f)
                    {
                        cout<<"Impossible"<<endl;
                        continue;
                    }

                    c=1;
                    i=0;
                    while(i<n)
                    {
                        if(!i)
                        {
                            j=di[i].ss;
                            ans[j]=c;
                        }
                        else if(di[i].ff==di[i-1].ff)
                        {
                            j=di[i].ss;
                            ans[j]=c;
                        }
                        else
                        {
                            c++;
                            j=di[i].ss;
                            ans[j]=c;
                        }
                        //cout<<di[i].ff<<" "<<j<<" "<<c<<endl;
                        i++;
                    }

                  /*  for(i=0;i<n;i++)
                    {
                        cout<<ans[i]<<" ";
                    }*/

                    i=0;
                    while(i<n)
                    {
                        j=di[i].ff;
                        k=fre[j];
                        if(k<=j)
                        {
                            while(i<n && di[i].ff==j)
                                i++;

                            continue;
                        }
                        else
                            c++;

                        while(i<n && k>j)
                        {
                            ans[di[i].ss]=c;
                            i++;
                            k--;
                        }
                        while(i<n && di[i].ff==j)
                            i++;
                    }

                  //  cout<<endl;
                    cout<<"Possible"<<endl;

                    for(i=0;i<n;i++)
                        cout<<ans[i]<<" ";

            }

}

ll mpower(ll x, ll y, ll p){
    ll res = 1;
    x = x % p;
    while(y > 0){
        if(y & 1) res = (res*x) % p;
        y = y>>1;
        x = (x*x) % p;
    }
    return res;
}

ll power(ll x, ll y){
    ll res = 1;
    while (y > 0){
        if (y & 1) res = res*x;
        y = y>>1;
        x = x*x;
    }
    return res;
}
bool isPrime(ll n){
    if (n <= 1)  return false;
    if (n <= 3)  return true;
    if (n%2 == 0 || n%3 == 0) return false;
    ll p=sqrt(n);
    for(int i=5;i<=p;i=i+6)
        if (n%i == 0 || n%(i+2) == 0)
            return false;
    return true;
}


#include<bits/stdc++.h>
using namespace std;

#define ll long long
#define ld long double
#define pb push_back
#define ff first
#define ss second
#define mp make_pair
#define ins insert
#define sb substr
#define con continue
#define ub upper_bound
#define lb lower_bound
#define pll pair<ll,ll>
#define pld pair<ld,ld>

ll power(ll x, ll y);
ll mpower(ll x, ll y, ll p);
bool isPrime(ll n);
ll const N=(ll)1e5;
vector<vector<ll> >g(N);
ll visited[N]={0};
ll restri[N]={0};
ll ans=0;

void dfs(ll v,ll a,ll c,ll m)
{

}

bool isPerfect(ll N)
    {
        if ((sqrt(N) - floor(sqrt(N))) != 0)
            return false;
        return true;
    }

int main()
{
            ios_base::sync_with_stdio(false);
            cin.tie(NULL);
            ll t,i,j,k,l,h,p,q,r,x,y,z,a,b,c,d,f,n,m,M=1000000007;

            t=1;

            while(t--)
            {
                    cin>>n;

                    ll arr[n],a[n]={0};

                    for(i=0;i<n;i++)
                    {
                        cin>>arr[i];
                        a[arr[i]]++;
                    }

                    p=0;
                    for(i=0;i<n;i++)
                    {
                        if(a[i])
                            p+=i;
                    }

                    if(p>n)
                    {
                        cout<<"Impossible"<<endl;
                        continue;
                    }

                    c=0;
                    ll ans[n]={0};
                    map<ll,ll>fre;

                    for(i=0;i<n;i++)
                    {
                        if(!fre[arr[i]])
                        {
                            c++;
                            fre[arr[i]]=c;
                            ans[i]=c;
                        }
                        else
                        {
                            ans[i]=fre[arr[i]];
                        }
                    }

                    cout<<"Possible"<<endl;

                    for(i=0;i<n;i++)
                        cout<<ans[i]<<" ";

                    cout<<endl;

            }

}

ll mpower(ll x, ll y, ll p){
    ll res = 1;
    x = x % p;
    while(y > 0){
        if(y & 1) res = (res*x) % p;
        y = y>>1;
        x = (x*x) % p;
    }
    return res;
}

ll power(ll x, ll y){
    ll res = 1;
    while (y > 0){
        if (y & 1) res = res*x;
        y = y>>1;
        x = x*x;
    }
    return res;
}
bool isPrime(ll n){
    if (n <= 1)  return false;
    if (n <= 3)  return true;
    if (n%2 == 0 || n%3 == 0) return false;
    ll p=sqrt(n);
    for(int i=5;i<=p;i=i+6)
        if (n%i == 0 || n%(i+2) == 0)
            return false;
    return true;
}


#include<bits/stdc++.h>
using namespace std;

#define ll long long
#define ld long double
#define pb push_back
#define ff first
#define ss second
#define mp make_pair
#define ins insert
#define sb substr
#define con continue
#define ub upper_bound
#define lb lower_bound
#define pll pair<ll,ll>
#define pld pair<ld,ld>

ll power(ll x, ll y);
ll mpower(ll x, ll y, ll p);
bool isPrime(ll n);
ll const N=(ll)1e5;
vector<vector<ll> >g(N);
ll visited[N]={0};
ll restri[N]={0};
ll ans=0;

void dfs(ll v,ll a,ll c,ll m)
{

}

bool isPerfect(ll N)
    {
        if ((sqrt(N) - floor(sqrt(N))) != 0)
            return false;
        return true;
    }

int main()
{
            ios_base::sync_with_stdio(false);
            cin.tie(NULL);
            ll t,i,j,k,l,h,p,q,r,x,y,z,a,b,c,d,f,n,m,M=1000000007;

            t=1;

            while(t--)
            {
                    cin>>n;

                    ll arr[n],a[n]={0};

                    for(i=0;i<n;i++)
                    {
                        cin>>arr[i];
                        a[arr[i]]++;
                    }

                    p=0;
                    for(i=0;i<n;i++)
                    {
                        if(a[i])
                            p+=i;
                    }

                    if(p>n || (a[0] && p>0))
                    {
                        cout<<"Impossible"<<endl;
                        continue;
                    }

                    c=0;
                    ll ans[n]={0};
                    map<ll,ll>fre;

                    for(i=0;i<n;i++)
                    {
                        if(!fre[arr[i]])
                        {
                            c++;
                            fre[arr[i]]=c;
                            ans[i]=c;
                        }
                        else
                        {
                            ans[i]=fre[arr[i]];
                        }
                    }

                    cout<<"Possible"<<endl;

                    for(i=0;i<n;i++)
                        cout<<ans[i]<<" ";

                    cout<<endl;

            }

}

ll mpower(ll x, ll y, ll p){
    ll res = 1;
    x = x % p;
    while(y > 0){
        if(y & 1) res = (res*x) % p;
        y = y>>1;
        x = (x*x) % p;
    }
    return res;
}

ll power(ll x, ll y){
    ll res = 1;
    while (y > 0){
        if (y & 1) res = res*x;
        y = y>>1;
        x = x*x;
    }
    return res;
}
bool isPrime(ll n){
    if (n <= 1)  return false;
    if (n <= 3)  return true;
    if (n%2 == 0 || n%3 == 0) return false;
    ll p=sqrt(n);
    for(int i=5;i<=p;i=i+6)
        if (n%i == 0 || n%(i+2) == 0)
            return false;
    return true;
}


#include<bits/stdc++.h>
using namespace std;

#define ll long long
#define ld long double
#define pb push_back
#define ff first
#define ss second
#define mp make_pair
#define ins insert
#define sb substr
#define con continue
#define ub upper_bound
#define lb lower_bound
#define pll pair<ll,ll>
#define pld pair<ld,ld>

ll power(ll x, ll y);
ll mpower(ll x, ll y, ll p);
bool isPrime(ll n);
ll const N=(ll)1e5;
vector<vector<ll> >g(N);
ll visited[N]={0};
ll restri[N]={0};
ll ans=0;

void dfs(ll v,ll a,ll c,ll m)
{

}

bool isPerfect(ll N)
    {
        if ((sqrt(N) - floor(sqrt(N))) != 0)
            return false;
        return true;
    }

int main()
{
            ios_base::sync_with_stdio(false);
            cin.tie(NULL);
            ll t,i,j,k,l,h,p,q,r,x,y,z,a,b,c,d,f,n,m,M=1000000007;

            t=1;

            while(t--)
            {
                    cin>>n;

                    ll arr[n],a[n]={0};

                    for(i=0;i<n;i++)
                    {
                        cin>>arr[i];
                        a[arr[i]]++;
                    }

                    p=0;
                    for(i=0;i<n;i++)
                    {
                        if(a[i])
                            p+=i;
                    }

                    if(p>n || (a[0] && p>0))
                    {
                        cout<<"Impossible"<<endl;
                        continue;
                    }

                    f=0;
                    for(i=0;i<n;i++)
                    {
                        if(a[i]==n)
                        {
                            f=1;
                            j=i;
                            break;
                        }

                    }
                        ll ans[n]={0};

                    if(f)
                    {
                        for(i=0;i<j;i++)
                        {
                            ans[i]=1;
                        }
                        for(i=j;i<n;i++)
                        {
                            ans[i]=2;
                        }
                    }
                    else
                    {
                       c=0;
                        map<ll,ll>fre;

                        for(i=0;i<n;i++)
                        {
                            if(!fre[arr[i]])
                            {
                                c++;
                                fre[arr[i]]=c;
                                ans[i]=c;
                            }
                            else
                            {
                                ans[i]=fre[arr[i]];
                            }
                        }

                    }
                    cout<<"Possible"<<endl;

                    for(i=0;i<n;i++)
                        cout<<ans[i]<<" ";

                    cout<<endl;

            }

}

ll mpower(ll x, ll y, ll p){
    ll res = 1;
    x = x % p;
    while(y > 0){
        if(y & 1) res = (res*x) % p;
        y = y>>1;
        x = (x*x) % p;
    }
    return res;
}

ll power(ll x, ll y){
    ll res = 1;
    while (y > 0){
        if (y & 1) res = res*x;
        y = y>>1;
        x = x*x;
    }
    return res;
}
bool isPrime(ll n){
    if (n <= 1)  return false;
    if (n <= 3)  return true;
    if (n%2 == 0 || n%3 == 0) return false;
    ll p=sqrt(n);
    for(int i=5;i<=p;i=i+6)
        if (n%i == 0 || n%(i+2) == 0)
            return false;
    return true;
}


#include<bits/stdc++.h>
using namespace std;

#define ll long long
#define ld long double
#define pb push_back
#define ff first
#define ss second
#define mp make_pair
#define ins insert
#define sb substr
#define con continue
#define ub upper_bound
#define lb lower_bound
#define pll pair<ll,ll>
#define pld pair<ld,ld>

ll power(ll x, ll y);
ll mpower(ll x, ll y, ll p);
bool isPrime(ll n);
ll const N=(ll)1e5;
vector<vector<ll> >g(N);
ll visited[N]={0};
ll restri[N]={0};
ll ans=0;
bool prime[200001];

void dfs(ll v,ll a,ll c,ll m)
{

}

ll gcd(ll a,ll b)
{
    if(a==0)
        return b;
    return gcd(b%a,a);
}

bool isPerfect(ll N)
    {
        if ((sqrt(N) - floor(sqrt(N))) != 0)
            return false;
        return true;
    }

void SieveOfEratosthenes(ll n)
{
    memset(prime, true, sizeof(prime));

    for (ll p=2; p*p<=n; p++)
    {
        if (prime[p] == true)
        {
            for (ll i=p*p; i<=n; i += p)
                prime[i] = false;
        }
    }

}

int main()
{
            ios_base::sync_with_stdio(false);
            cin.tie(NULL);
            ll t,i,j,k,l,h,p,q,r,x,y,z,a,b,c,d,f,n,m,M=1000000007;

            t=1;

            while(t--)
            {
                    cin>>n;

                    ll arr[n];
                    vector<pll>di;

                    for(i=0;i<n;i++)
                    {
                        cin>>arr[i];
                        di.pb(mp(arr[i],i));
                    }

                    sort(di.begin(),di.end());

                    if(di[0].ff==0 && di[n-1].ff!=0)
                    {
                        cout<<"Impossible"<<endl;
                        continue;
                    }

                    else if(di[0].ff==0)
                    {
                        cout<<"Possible"<<endl;
                        for(i=0;i<n;i++)
                            cout<<"1"<<" ";

                        cout<<endl;
                        continue;
                    }

                    for(i=0;i<n;i++)
                    {
                        di[i].ff=n-di[i].ff;
                    }

                    ll ans[n]={0};

                    map<ll,ll>fre;
                    f=0;
                    for(i=0;i<n;i++)
                    {
                      //  cout<<(di[i].ff)<<" ";
                        fre[di[i].ff]++;
                    }
                   // cout<<endl;

                    sort(di.begin(),di.end());
                    for(auto it=fre.begin();it!=fre.end();it++)
                    {
                        i=it->first;
                        j=it->second;

                        if(j%i!=0)
                        {
                          //  cout<<i<<" "<<j<<endl;
                            f=1;
                            break;
                        }
                    }

                    if(f)
                    {
                        cout<<"Impossible"<<endl;
                        continue;
                    }

                    c=0;
                    i=0;
                    k=0;
                    while(i<n)
                    {
                        j=di[i].ff;
                        while(i<n && di[i].ff==j)
                        {
                          //  cout<<k<<" "<<i<<" "<<c<<endl;
                            if(k==0)
                            {
                                k=j;
                                c++;
                            }

                            ans[di[i].ss]=c;
                            i++;
                            k--;
                        }

                    }
                    if(k!=0)
                    {
                        cout<<"Impossible"<<endl;
                        exit(0);
                    }

                  //  cout<<endl;
                    cout<<"Possible"<<endl;

                    for(i=0;i<n;i++)
                        cout<<ans[i]<<" ";

            }

}

ll mpower(ll x, ll y, ll p){
    ll res = 1;
    x = x % p;
    while(y > 0){
        if(y & 1) res = (res*x) % p;
        y = y>>1;
        x = (x*x) % p;
    }
    return res;
}

ll power(ll x, ll y){
    ll res = 1;
    while (y > 0){
        if (y & 1) res = res*x;
        y = y>>1;
        x = x*x;
    }
    return res;
}
bool isPrime(ll n){
    if (n <= 1)  return false;
    if (n <= 3)  return true;
    if (n%2 == 0 || n%3 == 0) return false;
    ll p=sqrt(n);
    for(int i=5;i<=p;i=i+6)
        if (n%i == 0 || n%(i+2) == 0)
            return false;
    return true;
}


#include<bits/stdc++.h>
using namespace std;

#define ll long long
#define ld long double
#define pb push_back
#define ff first
#define ss second
#define mp make_pair
#define ins insert
#define sb substr
#define con continue
#define ub upper_bound
#define lb lower_bound
#define pll pair<ll,ll>
#define pld pair<ld,ld>

ll power(ll x, ll y);
ll mpower(ll x, ll y, ll p);
bool isPrime(ll n);
ll const N=(ll)1e5;
vector<vector<ll> >g(N);
ll visited[N]={0};
ll restri[N]={0};
ll ans=0;

void dfs(ll v,ll a,ll c,ll m)
{

}

bool isPerfect(ll N)
    {
        if ((sqrt(N) - floor(sqrt(N))) != 0)
            return false;
        return true;
    }

int main()
{
            ios_base::sync_with_stdio(false);
            cin.tie(NULL);
            ll t,i,j,k,l,h,p,q,r,x,y,z,a,b,c,d,f,n,m,M=1000000007;
            t=1;

            while(t--)
            {
                    cin>>n;

                    ll arr[n],b[n]={0};
                    vector<pll>a;

                    f=0;
                    c=0;

                    for(i=0;i<n;i++)
                    {
                        cin>>arr[i];
                        b[arr[i]]++;
                        a.pb(mp(arr[i],i));
                        if(arr[i]==0)
                        {
                            f=1;
                            c++;
                        }
                    }

                    if(f && c<n)
                    {
                        cout<<"Impossible"<<endl;
                        continue;
                    }
                    else if(f)
                    {
                        cout<<"Possible"<<endl;
                        for(i=0;i<n;i++)
                        {
                            cout<<"1"<<" ";
                        }
                        cout<<endl;
                        continue;
                    }

                    sort(a.begin(),a.end());

                    ll ans[n];
                    i=n-1;
                    c=1;

                    while(i>=0)
                    {
                        if(c>n)
                        {
                            f=1;
                            break;
                        }
                        j=a[i].ff;
                      //  cout<<j<<" "<<b[j]<<endl;
                        if(n-b[j]<j)
                        {
                            k=j-n+b[j];
                        //    cout<<"1"<<" "<<k<<endl;
                            while(b[j]>k)
                            {
                                y=a[i].ss;
                                ans[y]=c;
                                i--;
                                b[j]--;
                            }
                            c++;
                            while(b[j]>0)
                            {
                                y=a[i].ss;
                                ans[y]=c;
                                i--;
                                b[j]--;
                            }
                        }
                        else
                        {
                            while(b[j]>0)
                            {
                                y=a[i].ss;
                                ans[y]=c;
                                i--;
                                b[j]--;
                            }
                        }
                        c++;

                    }
                    if(f)
                    {
                        cout<<"Impossible"<<endl;
                        continue;
                    }
                    else
                    {
                        cout<<"Possible"<<endl;

                        for(i=0;i<n;i++)
                            cout<<ans[i]<<" ";

                        cout<<endl;
                    }

            }

}

ll mpower(ll x, ll y, ll p){
    ll res = 1;
    x = x % p;
    while(y > 0){
        if(y & 1) res = (res*x) % p;
        y = y>>1;
        x = (x*x) % p;
    }
    return res;
}

ll power(ll x, ll y){
    ll res = 1;
    while (y > 0){
        if (y & 1) res = res*x;
        y = y>>1;
        x = x*x;
    }
    return res;
}
bool isPrime(ll n){
    if (n <= 1)  return false;
    if (n <= 3)  return true;
    if (n%2 == 0 || n%3 == 0) return false;
    ll p=sqrt(n);
    for(int i=5;i<=p;i=i+6)
        if (n%i == 0 || n%(i+2) == 0)
            return false;
    return true;
}


#include <bits/stdc++.h>

using namespace std;

const int maxn=100000 , mod = 1000000007 , inf = 1000000000;

long long n, m, k, x;
long long a[maxn], b[maxn];
string s;

vector <int> v;

int main()
{
    cin >> n;
    for(int i = 0; i < n; i ++)
    {
        cin >> a[i];
        b[i] = n - a[i];
    }
    sort(b, b+n);
    int i = 0;
    bool mark = 1;
    while(i < n)
    {
        int j = i;
        while(j < n && b[i] == b[j])
            j ++;
        j --;
        if(j - i + 1 == b[i])
            mark = 1;
        else
        {
            cout << "Impossible";
            return 0;
        }
        i = j + 1;
    }
    cout << "Possible" << endl;
    for(int i = 0; i < n; i ++)
        cout << n-a[i] << ' ' ;
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

const int maxn=100000 , mod = 1000000007 , inf = 1000000000;

long long n, k;
long long a[maxn], b[maxn], d[maxn], s[maxn][2], m[maxn];

vector <int> v;

int main()
{
    cin >> n;
    for(int i = 0; i < n; i ++)
    {
        cin >> a[i];
        b[i] = n - a[i];
    }
    sort(b, b+n);
    int i = 0;
    bool mark = 1;
    while(i < n)
    {
        int j = i;
        while(j < n && b[i] == b[j])
            j ++;
        if(j - i == b[i])
            mark = 1;
        else
        {
            mark = 0;
            break;
        }
        i = j;
    }
    if(mark)
    {
        cout << "Possible" << endl;
        for(int i = 0; i < n; i ++)
            cout << n-a[i] << ' ' ;
        return 0;
    }

    while(i < n)
    {
        int j = i;
        while(j < n && b[i] == b[j])
            j ++;
        if((j - i)%b[i] == 0)
        {
            d[b[i]] = (j-i)%b[i];
            s[b[i]][0] = i;
            s[b[i]][1] = j;
        }
        else
        {
            cout << "Impossible";
            return 0;
        }
        i = j;
    }
    cout << "Possible" << endl;
    for(int x = 0; x < n; x ++)
    {
        int r = n-a[x];
        m[r] ++;
        for(int y = s[r][0] ; y < s[r][1]; y ++)if(y%(s[r][1] - s[r][0]) == m[r]%(s[r][1] - s[r][0]))
            cout << y << ' ';
    }
}


#include <bits/stdc++.h>

using namespace std;

const int maxn=100000 , mod = 998244353 , inf = 1000000000;

long long n, m, k,s;
long long a[maxn], dp[2000][2000], b[maxn],q[maxn], c[maxn], mark[maxn];

vector <int> v;
/**
int f(int x, int y)
{
    if(x == 0 || x == y)
        return 1;
    if(!dp[x][y])
    {
        dp[x][y] = (f(x-1, y-1) + f(x, y-1))% mod;
    }
    return dp[x][y];
}
*/
int main()
{/**
    cin >> n >> m >> k;
    if(n == 1)
    {
        if(k == 0)
            cout << m;
        else
            cout << 0;
        return 0;
    }
    if(m == 1 && k > 0)
    {
        cout << 0;
        return 0;
    }
    s = (f(k, n-1)* m)%mod;
    for(int i = 0; i < k; i ++)
        s = (s*(m-1))%mod;
    cout << s;*/

    cin >> n;
    for(int i = 0; i < n; i ++)
    {
        cin >> a[i];
        q[a[i]] ++;
    }
    int clr = 1;
    for(int i = 0; i < n; i ++)
    {
        if(!mark[i])
        {
            c[i] = clr;
            mark[i]=1;
            int cnt=0;
            for(int j = i; j < n && cnt != n - a[i] - 1; j ++)
            {
                if(a[j] == a[i] && (!mark[j]))
                {
                    mark[j] = 1;
                    c[j] = clr;
                    cnt ++;
                }
            }
            clr ++;
        }
    }
    int ans = 0;
    for(int i = 0; i < n; i ++)
        ans += mark[i];
    if(ans < n)
    {
        cout << "Impossible";
        return 0;
    }
    cout << "Possible" << endl;
    for(int i = 0; i < n; i ++)
        cout << c[i] << ' ';
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

const int maxn=100000 , mod = 998244353 , inf = 1000000000;

long long n, m, k,s;
long long a[maxn], dp[2000][2000], b[maxn],q[maxn], c[maxn], mark[maxn];

vector <int> v;
/**
int f(int x, int y)
{
    if(x == 0 || x == y)
        return 1;
    if(!dp[x][y])
    {
        dp[x][y] = (f(x-1, y-1) + f(x, y-1))% mod;
    }
    return dp[x][y];
}
*/
int main()
{/**
    cin >> n >> m >> k;
    if(n == 1)
    {
        if(k == 0)
            cout << m;
        else
            cout << 0;
        return 0;
    }
    if(m == 1 && k > 0)
    {
        cout << 0;
        return 0;
    }
    s = (f(k, n-1)* m)%mod;
    for(int i = 0; i < k; i ++)
        s = (s*(m-1))%mod;
    cout << s;*/

    cin >> n;
    for(int i = 0; i < n; i ++)
    {
        cin >> a[i];
        b[i] = n - a[i];
    }
    sort(b, b+n);
    int i = 0;
    while(i < n)
    {
        int j = i;
        while(j < n && b[i] == b[j])
            j ++;
        if((j-i)%b[i] != 0)
        {
            cout << "Impossible";
            return 0;
        }
        i = j;
    }
    int clr = 1;
    for(int i = 0; i < n; i ++)
    {
        if(!mark[i])
        {
            c[i] = clr;
            mark[i]=1;
            int cnt=0;
            for(int j = i; j < n && cnt != n - a[i] - 1; j ++)
            {
                if(a[j] == a[i] && (!mark[j]))
                {
                    mark[j] = 1;
                    c[j] = clr;
                    cnt ++;
                }
            }
            clr ++;
        }
    }
    int ans = 0;
    for(int i = 0; i < n; i ++)
        ans += mark[i];
    if(ans < n)
    {
        cout << "Impossible";
        return 0;
    }
    cout << "Possible" << endl;
    for(int i = 0; i < n; i ++)
        cout << c[i] << ' ';
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

const int maxn=100000 , mod = 1000000007 , inf = 1000000000;

long long n, m, k, x;
long long a[maxn], b[maxn];
string s;

vector <int> v;

int main()
{
    cin >> n;
    for(int i = 0; i < n; i ++)
    {
        cin >> a[i];
        b[i] = n - a[i];
    }
    sort(b, b+n);
    int i = 0;
    bool mark = 1;
    while(i < n)
    {
        int j = i;
        while(j < n && b[i] == b[j])
            j ++;
        j --;
        if(j - i + 1 == b[i])
            mark = 1;
        else
        {
            cout << "Impossible";
            return 0;
        }
        i = j + 1;
    }
    cout << "possible" << endl;
    for(int i = 0; i < n; i ++)
        cout << n-a[i] << ' ' ;
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

const int maxn=100000 , mod = 1000000007 , inf = 1000000000;

long long n, k;
long long a[maxn], b[maxn], d[maxn], s[maxn][2], m[maxn];

vector <int> v;

int main()
{
    cin >> n;
    for(int i = 0; i < n; i ++)
    {
        cin >> a[i];
        b[i] = n - a[i];
    }
    sort(b, b+n);
    int i = 0;
    bool mark = 1;
    while(i < n)
    {
        int j = i;
        while(j < n && b[i] == b[j])
            j ++;
        if(j - i == b[i])
            mark = 1;
        else
        {
            mark = 0;
            break;
        }
        i = j;
    }
    if(mark)
    {
        cout << "Possible" << endl;
        for(int i = 0; i < n; i ++)
            cout << n-a[i] << ' ' ;
        return 0;
    }

    while(i < n)
    {
        int j = i;
        while(j < n && b[i] == b[j])
            j ++;
        if((j - i)%b[i] == 0)
        {
            d[b[i]] = (j-i)/b[i];
            s[b[i]][0] = i;
            s[b[i]][1] = i + d[b[i]] ;
        }
        else
        {
            cout << "Impossible";
            return 0;
        }
        i = j;
    }
    cout << "Possible" << endl;
    for(int x = 0; x < n; x ++)
    {
        int r = n-a[x];
        m[r] ++;
        for(int y = s[r][0] ; y < s[r][1]; y ++)if((y-s[r][0])%(d[r]) == m[r]%(d[r]))
            cout << y << ' ';
    }
}


#include<stdio.h>
#include<iostream>
#include<algorithm>
using namespace std;
const int maxn=100005;
int n,k=1;
int sum[maxn],num[maxn],ans[maxn],cou[maxn],dis[maxn];
int main()
{
	int flag=0;
	scanf("%d",&n);
	fill(num,num+(n+1),0);
	fill(ans,ans+(n+1),0);
	fill(cou,cou+(n+1),0);
	fill(dis,dis+(n+1),0);
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&sum[i]);
		num[sum[i]]=n-sum[i];
		cou[sum[i]]++;
		//if(num[sum[i]]>cou[sum[i]]) flag=1;
	}
	for(int i=1;i<=n;i++)
		if(num[sum[i]]>cou[sum[i]]) flag=1;
	if(flag) {
		printf("Impossible\n");
		return 0;
	}
	dis[sum[1]]=ans[1]=1;
	for(int i=2;i<=n;i++)
	{
		if(dis[sum[i]]==0) {
			ans[i]=dis[sum[i]]=++k;
		}
		else {
			//if(sum[i]==sum[i-1])
			//{
				if(num[sum[i]]==cou[sum[i]]) {
						ans[i]=dis[sum[i]];
				}
				else {
					if(cou[sum[i]]>1) {
						ans[i]=dis[sum[i]];
						cou[sum[i]]--;
					}
					else ans[i]=dis[sum[i]]=++k;
				}
			//}
			/*else
			{
				if(num[sum[i]]==cou[sum[i]]) {
						ans[i]=dis[sum[i]];
				}
				else {
					if(cou[sum[i]]>1) {
						ans[i]=dis[sum[i]];
						cou[sum[i]]--;
					}
					else ans[i]=dis[sum[i]]=++k;
				}
			}*/
		}
	}
	printf("Possible\n");
	for(int i=1;i<=n;i++)
		printf("%d ",ans[i]);
	printf("\n");
	return 0;
}


#include<stdio.h>
#include<iostream>
#include<algorithm>
using namespace std;
const int maxn=100005;
int n,k=1;
int sum[maxn],num[maxn],num1[maxn],ans[maxn],cou[maxn],dis[maxn];
int main()
{
	int flag=0,count;
	scanf("%d",&n);
	fill(num,num+(n+1),0);
	fill(num1,num1+(n+1),0);
	fill(ans,ans+(n+1),0);
	fill(cou,cou+(n+1),0);
	fill(dis,dis+(n+1),0);
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&sum[i]);
		num[sum[i]]=n-sum[i];
		cou[sum[i]]++;
		//if(num[sum[i]]>cou[sum[i]]) flag=1;
	}
	for(int i=1;i<=n;i++)
	{
		if(num[sum[i]]>cou[sum[i]]) flag=1;
		num1[sum[i]]=num[sum[i]];
	}
	if(flag) {
		printf("Impossible\n");
		return 0;
	}
	dis[sum[1]]=ans[1]=1;
	for(int i=2;i<=n;i++)
	{
		if(dis[sum[i]]==0) {
			ans[i]=dis[sum[i]]=++k;
		}
		else {
			//if(sum[i]==sum[i-1])
			//{
				if(num[sum[i]]==cou[sum[i]]) {
						ans[i]=dis[sum[i]];
				}
				else {
					if(num[sum[i]]>1) {
						ans[i]=dis[sum[i]];
						num[sum[i]]--;
					}
					else {
						ans[i]=dis[sum[i]]=++k;
						num[sum[i]]=num1[sum[i]];
					}
				}
			//}
			/*else
			{
				if(num[sum[i]]==cou[sum[i]]) {
						ans[i]=dis[sum[i]];
				}
				else {
					if(cou[sum[i]]>1) {
						ans[i]=dis[sum[i]];
						cou[sum[i]]--;
					}
					else ans[i]=dis[sum[i]]=++k;
				}
			}*/
		}
	}
	if(k>n) printf("Impossible\n");
	else {
		printf("Possible\n");
		for(int i=1;i<=n;i++)
			printf("%d ",ans[i]);
		printf("\n");
	}
	return 0;
}


#include<stdio.h>
#include<iostream>
#include<algorithm>
using namespace std;
const int maxn=100005;
int n,k=1,flag=0;
int sum[maxn],num[maxn],num1[maxn],ans[maxn],cou[maxn],dis[maxn];
void check()
{
	for(int i=1;i<=n;i++)
		cou[ans[i]]++;
	for(int i=1;i<=n;i++)
		if(cou[ans[i]]+sum[i]!=n) flag=1;
}
int main()
{
	scanf("%d",&n);
	//fill(ans,ans+(n+1),0);
	//fill(num,num+(n+1),0);
	//fill(num1,num1+(n+1),0);
	//fill(cou,cou+(n+1),0);
	//fill(dis,dis+(n+1),0);
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&sum[i]);
		num[sum[i]]=n-sum[i];
		cou[sum[i]]++;
	}
	for(int i=1;i<=n;i++)
	{
		if(num[sum[i]]>cou[sum[i]]) {
			printf("Impossible\n");
			flag=1;
			break;;
		}
		num1[sum[i]]=num[sum[i]];
	}
	if(flag) return 0;
	dis[sum[1]]=ans[1]=1;
	for(int i=2;i<=n;i++)
	{
		if(dis[sum[i]]==0) {
			ans[i]=dis[sum[i]]=++k;
		}
		else {
			if(num[sum[i]]==cou[sum[i]]) {
					ans[i]=dis[sum[i]];
			}
			else {
				if(num[sum[i]]>1) {
					ans[i]=dis[sum[i]];
					num[sum[i]]--;
				}
				else {
					ans[i]=dis[sum[i]]=++k;
					num[sum[i]]=num1[sum[i]];
				}
			}
		}
	}
	fill(cou,cou+(n+1),0);
	if(k>n||flag)
		printf("Impossible\n");
	else {
		printf("Possible\n");
		for(int i=1;i<=n;i++)
			printf("%d ",ans[i]);
		printf("\n");
	}
	return 0;
}


#include<stdio.h>
#include<iostream>
#include<algorithm>
using namespace std;
const int maxn=100005;
int n,k=1,flag=0;
int sum[maxn],num[maxn],num1[maxn],ans[maxn],cou[maxn],dis[maxn];
void check()
{
	for(int i=1;i<=n;i++)
		cou[ans[i]]++;
	for(int i=1;i<=n;i++)
		if(cou[ans[i]]+sum[i]!=n) flag=1;
}
int main()
{
	scanf("%d",&n);
	//fill(ans,ans+(n+1),0);
	//fill(num,num+(n+1),0);
	//fill(num1,num1+(n+1),0);
	//fill(cou,cou+(n+1),0);
	//fill(dis,dis+(n+1),0);
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&sum[i]);
		num[sum[i]]=n-sum[i];
		cou[sum[i]]++;
	}
	for(int i=1;i<=n;i++)
	{
		if(num[sum[i]]>cou[sum[i]]) {
			printf("Impossible\n");
			flag=1;
			break;;
		}
		num1[sum[i]]=num[sum[i]];
	}
	if(flag) return 0;
	dis[sum[1]]=ans[1]=1;
	for(int i=2;i<=n;i++)
	{
		if(dis[sum[i]]==0) {
			ans[i]=dis[sum[i]]=++k;
		}
		else {
			if(num[sum[i]]==cou[sum[i]]) {
					ans[i]=dis[sum[i]];
			}
			else {
				if(num[sum[i]]>1) {
					ans[i]=dis[sum[i]];
					num[sum[i]]--;
				}
				else {
					ans[i]=dis[sum[i]]=++k;
					num[sum[i]]=num1[sum[i]];
				}
			}
		}
	}
	check();
	fill(cou,cou+(n+1),0);
	if(k>n||flag)
		printf("Impossible\n");
	else {
		printf("Possible\n");
		for(int i=1;i<=n;i++)
			printf("%d ",ans[i]);
		printf("\n");
	}
	return 0;
}


#include<stdio.h>
#include<iostream>
#include<algorithm>
using namespace std;
const int maxn=100005;
int n,k=1;
int sum[maxn],num[maxn],num1[maxn],ans[maxn],cou[maxn],dis[maxn];
int main()
{
	int flag=0,count;
	scanf("%d",&n);
	fill(num,num+(n+1),0);
	fill(num1,num1+(n+1),0);
	fill(ans,ans+(n+1),0);
	fill(cou,cou+(n+1),0);
	fill(dis,dis+(n+1),0);
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&sum[i]);
		num[sum[i]]=n-sum[i];
		cou[sum[i]]++;
		//if(num[sum[i]]>cou[sum[i]]) flag=1;
	}
	for(int i=1;i<=n;i++)
	{
		if(num[sum[i]]>cou[sum[i]]) flag=1;
		num1[sum[i]]=num[sum[i]];
	}
	if(flag) {
		printf("Impossible\n");
		return 0;
	}
	dis[sum[1]]=ans[1]=1;
	for(int i=2;i<=n;i++)
	{
		if(dis[sum[i]]==0) {
			ans[i]=dis[sum[i]]=++k;
		}
		else {
			//if(sum[i]==sum[i-1])
			//{
				if(num[sum[i]]==cou[sum[i]]) {
						ans[i]=dis[sum[i]];
				}
				else {
					if(num[sum[i]]>1) {
						ans[i]=dis[sum[i]];
						num[sum[i]]--;
					}
					else {
						ans[i]=dis[sum[i]]=++k;
						num[sum[i]]=num1[sum[i]];
					}
				}
			//}
			/*else
			{
				if(num[sum[i]]==cou[sum[i]]) {
						ans[i]=dis[sum[i]];
				}
				else {
					if(cou[sum[i]]>1) {
						ans[i]=dis[sum[i]];
						cou[sum[i]]--;
					}
					else ans[i]=dis[sum[i]]=++k;
				}
			}*/
		}
	}
	printf("Possible\n");
	for(int i=1;i<=n;i++)
		printf("%d ",ans[i]);
	printf("\n");
	return 0;
}


#include<stdio.h>
#include<iostream>
#include<algorithm>
using namespace std;
const int maxn=100005;
int n,k=1,flag=0;
int sum[maxn],num[maxn],num1[maxn],ans[maxn],cou[maxn],dis[maxn];
void check()
{
	for(int i=1;i<=n;i++)
		cou[ans[i]]++;
	for(int i=1;i<=n;i++)
		if(cou[ans[i]]+sum[i]!=n) flag=1;
}
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&sum[i]);
		num[sum[i]]=n-sum[i];
		cou[sum[i]]++;
	}
	for(int i=1;i<=n;i++)
	{
		if(num[sum[i]]>cou[sum[i]]) {
			//printf("Impossible\n");
			flag=1;
			//break;
		}
		num1[sum[i]]=num[sum[i]];
	}
	//if(flag) return 0;
	dis[sum[1]]=ans[1]=1;
	for(int i=2;i<=n;i++)
	{
		if(dis[sum[i]]==0) {
			ans[i]=dis[sum[i]]=++k;
		}
		else {
			if(num[sum[i]]==cou[sum[i]]) {
					ans[i]=dis[sum[i]];
			}
			else {
				if(num[sum[i]]>1) {
					ans[i]=dis[sum[i]];
					num[sum[i]]--;
				}
				else {
					ans[i]=dis[sum[i]]=++k;
					num[sum[i]]=num1[sum[i]];
				}
			}
		}
	}
	fill(cou,cou+(n+1),0);
	check();
	if(k>n||flag)
		printf("Impossible\n");
	else {
		printf("Possible\n");
		for(int i=1;i<=n;i++)
			printf("%d ",ans[i]);
		printf("\n");
	}
	return 0;
}


#include<stdio.h>
#include<iostream>
#include<algorithm>
using namespace std;
const int maxn=100005;
int n,k=1;
int sum[maxn],num[maxn],num1[maxn],ans[maxn],cou[maxn],dis[maxn];
int main()
{
	int flag=0;
	scanf("%d",&n);
	fill(ans,ans+(n+1),0);
	fill(num,num+(n+1),0);
	fill(num1,num1+(n+1),0);
	fill(cou,cou+(n+1),0);
	fill(dis,dis+(n+1),0);
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&sum[i]);
		num[sum[i]]=n-sum[i];
		cou[sum[i]]++;
	}
	for(int i=1;i<=n;i++)
	{
		if(num[sum[i]]>cou[sum[i]]) {
			printf("Impossible\n");
			flag=1;
			break;;
		}
		num1[sum[i]]=num[sum[i]];
	}
	if(flag) return 0;
	dis[sum[1]]=ans[1]=1;
	for(int i=2;i<=n;i++)
	{
		if(dis[sum[i]]==0) {
			ans[i]=dis[sum[i]]=++k;
		}
		else {
			if(num[sum[i]]==cou[sum[i]]) {
					ans[i]=dis[sum[i]];
			}
			else {
				if(num[sum[i]]>1) {
					ans[i]=dis[sum[i]];
					num[sum[i]]--;
				}
				else {
					ans[i]=dis[sum[i]]=++k;
					num[sum[i]]=num1[sum[i]];
				}
			}
		}
	}
	fill(cou,cou+(n+1),0);
	for(int i=1;i<=n;i++)
	{
		cou[ans[i]]++;
	}
	for(int i=1;i<=n;i++)
	{
		if(cou[ans[i]]+sum[i]!=n) flag=1;
	}
	if(k>n||flag) printf("Impossible\n");
	else {
		printf("Possible\n");
		for(int i=1;i<=n;i++)
			printf("%d ",ans[i]);
		printf("\n");
	}
	return 0;
}


#include<stdio.h>
#include<iostream>
#include<algorithm>
using namespace std;
const int maxn=100005;
int n,k=1;
int sum[maxn],num[maxn],num1[maxn],ans[maxn],cou[maxn],dis[maxn];
int main()
{
	int flag=0;
	scanf("%d",&n);
	fill(ans,ans+(n+1),0);
	fill(num,num+(n+1),0);
	fill(num1,num1+(n+1),0);
	fill(cou,cou+(n+1),0);
	fill(dis,dis+(n+1),0);
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&sum[i]);
		num[sum[i]]=n-sum[i];
		cou[sum[i]]++;
	}
	for(int i=1;i<=n;i++)
	{
		if(num[sum[i]]>cou[sum[i]]) {
			printf("Impossible\n");
			flag=1;
			break;;
		}
		num1[sum[i]]=num[sum[i]];
	}
	if(flag) return 0;
	dis[sum[1]]=ans[1]=1;
	for(int i=2;i<=n;i++)
	{
		if(dis[sum[i]]==0) {
			ans[i]=dis[sum[i]]=++k;
		}
		else {
			if(num[sum[i]]==cou[sum[i]]) {
					ans[i]=dis[sum[i]];
			}
			else {
				if(num[sum[i]]>1) {
					ans[i]=dis[sum[i]];
					num[sum[i]]--;
				}
				else {
					ans[i]=dis[sum[i]]=++k;
					num[sum[i]]=num1[sum[i]];
				}
			}
		}
	}
	fill(num,num+(n+1),0);
	fill(num1,num1+(n+1),0);
	fill(cou,cou+(n+1),0);
	fill(dis,dis+(n+1),0);
	for(int i=1;i<=n;i++)
	{
		cou[sum[i]]++;
	}
	for(int i=1;i<=n;i++)
	{
		if(cou[sum[i]]+sum[i]!=n) flag=1;
	}
	if(k>n||flag) printf("Impossible\n");
	else {
		printf("Possible\n");
		for(int i=1;i<=n;i++)
			printf("%d ",ans[i]);
		printf("\n");
	}
	return 0;
}


#include<stdio.h>
#include<iostream>
#include<algorithm>
using namespace std;
const int maxn=100005;
int n,k=1,flag=0;
int sum[maxn],num[maxn],num1[maxn],ans[maxn],cou[maxn],dis[maxn];
void check()
{
	for(int i=1;i<=n;i++)
		cou[ans[i]]++;
	for(int i=1;i<=n;i++)
		if(cou[ans[i]]+sum[i]!=n) flag=1;
}
int main()
{
	scanf("%d",&n);
	//fill(ans,ans+(n+1),0);
	//fill(num,num+(n+1),0);
	//fill(num1,num1+(n+1),0);
	//fill(cou,cou+(n+1),0);
	//fill(dis,dis+(n+1),0);
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&sum[i]);
		num[sum[i]]=n-sum[i];
		cou[sum[i]]++;
	}
	for(int i=1;i<=n;i++)
	{
		if(num[sum[i]]>cou[sum[i]]) {
			printf("Impossible\n");
			flag=1;
			break;;
		}
		num1[sum[i]]=num[sum[i]];
	}
	if(flag) return 0;
	dis[sum[1]]=ans[1]=1;
	for(int i=2;i<=n;i++)
	{
		if(dis[sum[i]]==0) {
			ans[i]=dis[sum[i]]=++k;
		}
		else {
			if(num[sum[i]]==cou[sum[i]]) {
					ans[i]=dis[sum[i]];
			}
			else {
				if(num[sum[i]]>1) {
					ans[i]=dis[sum[i]];
					num[sum[i]]--;
				}
				else {
					ans[i]=dis[sum[i]]=++k;
					num[sum[i]]=num1[sum[i]];
				}
			}
		}
	}
	fill(cou,cou+(n+1),0);
	check();
	if(k>n||flag)
		printf("Impossible\n");
	else {
		printf("Possible\n");
		for(int i=1;i<=n;i++)
			printf("%d ",ans[i]);
		printf("\n");
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define fast ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define rep(i,n) for(ll i=0;i<n;i++)
#define repp(i,a,b) for(ll i=a;i<=b;i++)
#define reff(i,a,b) for(ll i=a;i>=b;i--)
#define ll long long int
#define pll pair<ll,ll>
#define fill(a,x) memset(a,x,sizeof(a))
#define mb make_pair
#define pb push_back
#define F first
#define S second
#define M 1000000007
#define sc(x) scanf("%d",&x)
#define scc(x1,x2) scanf("%d%d",&x1,&x2)
#define sccc(x1,x2,x3) scanf("%d%d%d",&x1,&x2,&x3)
#define pr(x) printf("%lld ",x)
#define dbg(a)          std::cerr<<#a<<"="<<(a)<<"\n"
#define dbg1(a,b)       std::cerr<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<"\n"
#define dbg2(a,b,c)     std::cerr<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<"\n"
#define dbg3(a,b,c,d)   std::cerr<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<", "<<#d<<"="<<(d)<<"\n"
#define all(v) v.begin(),v.end()
#define PI 3.14159265
#define co cout<<"fuck"<<endl
const int INF = 2034567891;
const ll INF64 = 4234567890123456789ll;
long long nc3(long long v){return (v * (v - 1ll) * (v - 2ll)) / 6ll;}
long long nc2(long long v){return (v * (v - 1ll)) / 2ll;}
ll gcd(ll a, ll b) { return (b == 0 ? a : gcd(b, a % b)); }
ll lcm(ll a, ll b) { return (a * (b / gcd(a, b))); }
const int N = 10+2e5;
bool isprime(ll n) {
    if (n < 2) return 0;
    if (n == 2) return 1;
    if (n % 2 == 0) return 0;
    for (ll i = 3; i*i <= n; i++) if (n%i == 0) return 0;
    return 1;
}
double dist(pll p1, pll p2)
 {
    return (p1. F - p2.F)*(p1.F - p2.F) +
          (p1.S - p2.S)*(p1.S - p2.S);
 }
ll power(ll x,ll y)
{
    ll ans=1;
    while(y>0){
        if(y&1)
            ans=(ans*x)%M;
        x=(x*x);
        y/=2;
    }
    return ans%M;
}
int main()
{
    fast;
    ll n;
    cin>>n;
    pll a[n+1];
    ll cnt0=0;
    repp(i,1,n)
	{
	  cin>>a[i].F;
	  a[i].S=i;
	  if(a[i].F==0) cnt0++;
	}
    sort(a+1,a+n+1);
    reverse(a+1,a+n+1);
	if(cnt0 && cnt0!=n)
	{
	   cout<<"Impossible";
	   return 0;
	}
	if(cnt0 && cnt0==n)
	{
	   cout<<"Possible";
	   cout<<endl;
	   repp(i,1,n) cout<<"1"<<" ";
	   return 0;
	}
//	if(n==1)
//	{
//	  cout<<"Possible";
//	  cout<<endl;
//	  cout<<"1";
//	  return 0;
//	}
	ll st=n-a[1].F;
	//dbg(st);
	ll ans[n+1];
	ll cnt[n+1];
	fill(cnt,0);
	cnt[1]=a[1].F;
	repp(i,1,st)
	{
	   ans[i]=1;
	}
	repp(i,st+1,n)
	ans[i]=2;
	repp(i,2,n)
	{
	   // dbg1(i,ans[i]);
	    if(ans[i]==ans[i-1])
	    {
	       if(a[i].F==a[i-1].F)
	       {
	        continue;
	       }
	       else
	       {
	         cout<<"Impossible";
	         return 0;
		   }
		}
		if((i-1)>a[i].F)
		{
		  cout<<"Impossible";
		  return 0;
		}
		if((i-1)==a[i].F) continue;
		ll more=a[i].F-(i-1);
		ll rem=n-i;
		if(rem<more)
		{
		  cout<<"Impossible";
		  return 0;
		}
		if(rem==more)
		{
		   repp(j,i+1,n)
		   ans[j]=ans[i]+1;
		}
		else
		{
		   ll j=n;
		   while(more)
		   {
		    ans[j]=ans[i]+1;
		    j--;
		    more--;
		   }
		}

	}
	vector<ll>v(n+1);
	repp(i,1,n)
	{
	   v[a[i].S]=ans[i];
	}
	cout<<"Possible"<<endl;
	repp(i,1,v.size()-1)
	cout<<v[i]<<" ";
}


#include<bits/stdc++.h>
using namespace std;
#define fast ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define rep(i,n) for(ll i=0;i<n;i++)
#define repp(i,a,b) for(ll i=a;i<=b;i++)
#define reff(i,a,b) for(ll i=a;i>=b;i--)
#define ll long long int
#define pll pair<ll,ll>
#define fill(a,x) memset(a,x,sizeof(a))
#define mb make_pair
#define pb push_back
#define F first
#define S second
#define M 1000000007
#define sc(x) scanf("%d",&x)
#define scc(x1,x2) scanf("%d%d",&x1,&x2)
#define sccc(x1,x2,x3) scanf("%d%d%d",&x1,&x2,&x3)
#define pr(x) printf("%lld ",x)
#define dbg(a)          std::cerr<<#a<<"="<<(a)<<"\n"
#define dbg1(a,b)       std::cerr<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<"\n"
#define dbg2(a,b,c)     std::cerr<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<"\n"
#define dbg3(a,b,c,d)   std::cerr<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<", "<<#d<<"="<<(d)<<"\n"
#define all(v) v.begin(),v.end()
#define PI 3.14159265
#define co cout<<"fuck"<<endl
const int INF = 2034567891;
const ll INF64 = 4234567890123456789ll;
long long nc3(long long v){return (v * (v - 1ll) * (v - 2ll)) / 6ll;}
long long nc2(long long v){return (v * (v - 1ll)) / 2ll;}
ll gcd(ll a, ll b) { return (b == 0 ? a : gcd(b, a % b)); }
ll lcm(ll a, ll b) { return (a * (b / gcd(a, b))); }
const int N = 10+2e5;
bool isprime(ll n) {
    if (n < 2) return 0;
    if (n == 2) return 1;
    if (n % 2 == 0) return 0;
    for (ll i = 3; i*i <= n; i++) if (n%i == 0) return 0;
    return 1;
}
double dist(pll p1, pll p2)
 {
    return (p1. F - p2.F)*(p1.F - p2.F) +
          (p1.S - p2.S)*(p1.S - p2.S);
 }
ll power(ll x,ll y)
{
    ll ans=1;
    while(y>0){
        if(y&1)
            ans=(ans*x)%M;
        x=(x*x);
        y/=2;
    }
    return ans%M;
}
int main()
{
    fast;
    ll n;
    cin>>n;
    pll a[n+1];
    ll cnt0=0;
    repp(i,1,n)
	{
	  cin>>a[i].F;
	  a[i].S=i;
	  if(a[i].F==0) cnt0++;
	}
    sort(a+1,a+n+1);
    reverse(a+1,a+n+1);
	if(cnt0 && cnt0!=n)
	{
	   cout<<"Impossible";
	   return 0;
	}
	if(cnt0 && cnt0==n)
	{
	   cout<<"Possible";
	   cout<<endl;
	   repp(i,1,n) cout<<"1"<<" ";
	   return 0;
	}
//	if(n==1)
//	{
//	  cout<<"Possible";
//	  cout<<endl;
//	  cout<<"1";
//	  return 0;
//	}
	ll st=n-a[1].F;
	//dbg(st);
	ll ans[n+1];
	ll cnt[n+1];
	fill(cnt,0);
	cnt[1]=a[1].F;
	repp(i,1,st)
	{
	   ans[i]=1;
	}
	repp(i,st+1,n)
	ans[i]=2;
	repp(i,2,n)
	{
	   // dbg1(i,ans[i]);
	    if(ans[i]==ans[i-1])
	    {
	       if(a[i].F==a[i-1].F)
	       {
		    cnt[i]=cnt[i-1];
	        continue;
	       }
	       else
	       {
	         cout<<"Impossible";
	         return 0;
		   }
		}
		if((i-1)>a[i].F)
		{
		  cout<<"Impossible";
		  return 0;
		}
		if((i-1)==a[i].F) continue;
		st=i+a[i].F-(i-1);
		//dbg(st);
		repp(j,st,n)
		ans[j]=ans[i]+1;
		cnt[i]=a[i].F;
	}
	vector<ll>v(n+1);
	repp(i,1,n)
	{
	   v[a[i].S]=ans[i];
	}
	cout<<"Possible"<<endl;
	repp(i,1,v.size()-1)
	cout<<v[i]<<" ";
}


#include<bits/stdc++.h>
using namespace std;
#define fast ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define rep(i,n) for(ll i=0;i<n;i++)
#define repp(i,a,b) for(ll i=a;i<=b;i++)
#define reff(i,a,b) for(ll i=a;i>=b;i--)
#define ll long long int
#define pll pair<ll,ll>
#define fill(a,x) memset(a,x,sizeof(a))
#define mb make_pair
#define pb push_back
#define F first
#define S second
#define M 1000000007
#define sc(x) scanf("%d",&x)
#define scc(x1,x2) scanf("%d%d",&x1,&x2)
#define sccc(x1,x2,x3) scanf("%d%d%d",&x1,&x2,&x3)
#define pr(x) printf("%lld ",x)
#define dbg(a)          std::cerr<<#a<<"="<<(a)<<"\n"
#define dbg1(a,b)       std::cerr<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<"\n"
#define dbg2(a,b,c)     std::cerr<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<"\n"
#define dbg3(a,b,c,d)   std::cerr<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<", "<<#d<<"="<<(d)<<"\n"
#define all(v) v.begin(),v.end()
#define PI 3.14159265
#define co cout<<"fuck"<<endl
const int INF = 2034567891;
const ll INF64 = 4234567890123456789ll;
long long nc3(long long v){return (v * (v - 1ll) * (v - 2ll)) / 6ll;}
long long nc2(long long v){return (v * (v - 1ll)) / 2ll;}
ll gcd(ll a, ll b) { return (b == 0 ? a : gcd(b, a % b)); }
ll lcm(ll a, ll b) { return (a * (b / gcd(a, b))); }
const int N = 10+2e5;
bool isprime(ll n) {
    if (n < 2) return 0;
    if (n == 2) return 1;
    if (n % 2 == 0) return 0;
    for (ll i = 3; i*i <= n; i++) if (n%i == 0) return 0;
    return 1;
}
double dist(pll p1, pll p2)
 {
    return (p1. F - p2.F)*(p1.F - p2.F) +
          (p1.S - p2.S)*(p1.S - p2.S);
 }
ll power(ll x,ll y)
{
    ll ans=1;
    while(y>0){
        if(y&1)
            ans=(ans*x)%M;
        x=(x*x);
        y/=2;
    }
    return ans%M;
}
int main()
{
    fast;
    ll n;
    cin>>n;
    pll a[n+1];
    ll cnt0=0;
    map<ll,ll>mp;
    repp(i,1,n)
	{
	  cin>>a[i].F;
	  a[i].S=i;
	  mp[a[i].F]++;
	}
	sort(a+1,a+n+1);
	vector<ll>ans(n+1,0);
	ll num=1;
    repp(i,1,n)
    {
        //if(ans[a[i].S]) continue;
        ll b=n-a[i].F;
        if(mp[a[i].F]%b)
        {
           cout<<"Impossible";
           return 0;
		}
		repp(j,i,i+b-1)
		{
		   ans[a[j].S]=num;
		}
		i+=b-1;
		num++;
	}
	cout<<"Possible"<<endl;
	repp(i,1,n) cout<<ans[i]<<" ";
}


#include<bits/stdc++.h>
using namespace std;
#define fast ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define rep(i,n) for(ll i=0;i<n;i++)
#define repp(i,a,b) for(ll i=a;i<=b;i++)
#define reff(i,a,b) for(ll i=a;i>=b;i--)
#define ll long long int
#define pll pair<ll,ll>
#define fill(a,x) memset(a,x,sizeof(a))
#define mb make_pair
#define pb push_back
#define F first
#define S second
#define M 1000000007
#define sc(x) scanf("%d",&x)
#define scc(x1,x2) scanf("%d%d",&x1,&x2)
#define sccc(x1,x2,x3) scanf("%d%d%d",&x1,&x2,&x3)
#define pr(x) printf("%lld ",x)
#define dbg(a)          std::cerr<<#a<<"="<<(a)<<"\n"
#define dbg1(a,b)       std::cerr<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<"\n"
#define dbg2(a,b,c)     std::cerr<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<"\n"
#define dbg3(a,b,c,d)   std::cerr<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<", "<<#d<<"="<<(d)<<"\n"
#define all(v) v.begin(),v.end()
#define PI 3.14159265
#define co cout<<"fuck"<<endl
const int INF = 2034567891;
const ll INF64 = 4234567890123456789ll;
long long nc3(long long v){return (v * (v - 1ll) * (v - 2ll)) / 6ll;}
long long nc2(long long v){return (v * (v - 1ll)) / 2ll;}
ll gcd(ll a, ll b) { return (b == 0 ? a : gcd(b, a % b)); }
ll lcm(ll a, ll b) { return (a * (b / gcd(a, b))); }
const int N = 10+2e5;
bool isprime(ll n) {
    if (n < 2) return 0;
    if (n == 2) return 1;
    if (n % 2 == 0) return 0;
    for (ll i = 3; i*i <= n; i++) if (n%i == 0) return 0;
    return 1;
}
double dist(pll p1, pll p2)
 {
    return (p1. F - p2.F)*(p1.F - p2.F) +
          (p1.S - p2.S)*(p1.S - p2.S);
 }
ll power(ll x,ll y)
{
    ll ans=1;
    while(y>0){
        if(y&1)
            ans=(ans*x)%M;
        x=(x*x);
        y/=2;
    }
    return ans%M;
}
int main()
{
    fast;
    ll n;
    cin>>n;
    pll a[n+1];
    ll cnt0=0;
    map<ll,ll>mp;
    repp(i,1,n)
	{
	  cin>>a[i].F;
	  a[i].S=i;
	  mp[a[i].F]++;
	}
	sort(a,a+n);
	vector<ll>ans(n+1);
	ll num=1;
    repp(i,1,n)
    {
        if(ans[a[i].S]) continue;
        ll b=n-a[i].F;
        if(mp[a[i].F]%b)
        {
           cout<<"Impossible";
           return 0;
		}
		repp(j,i,i+b-1)
		{
		   ans[a[j].S]=num;
		}
		num++;
	}
	cout<<"Possible"<<endl;
	repp(i,1,n) cout<<ans[i]<<" ";
}


#include<bits/stdc++.h>
using namespace std;
#define fast ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define rep(i,n) for(ll i=0;i<n;i++)
#define repp(i,a,b) for(ll i=a;i<=b;i++)
#define reff(i,a,b) for(ll i=a;i>=b;i--)
#define ll long long int
#define pll pair<ll,ll>
#define fill(a,x) memset(a,x,sizeof(a))
#define mb make_pair
#define pb push_back
#define F first
#define S second
#define M 1000000007
#define sc(x) scanf("%d",&x)
#define scc(x1,x2) scanf("%d%d",&x1,&x2)
#define sccc(x1,x2,x3) scanf("%d%d%d",&x1,&x2,&x3)
#define pr(x) printf("%lld ",x)
#define dbg(a)          std::cerr<<#a<<"="<<(a)<<"\n"
#define dbg1(a,b)       std::cerr<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<"\n"
#define dbg2(a,b,c)     std::cerr<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<"\n"
#define dbg3(a,b,c,d)   std::cerr<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<", "<<#d<<"="<<(d)<<"\n"
#define all(v) v.begin(),v.end()
#define PI 3.14159265
#define co cout<<"fuck"<<endl
const int INF = 2034567891;
const ll INF64 = 4234567890123456789ll;
long long nc3(long long v){return (v * (v - 1ll) * (v - 2ll)) / 6ll;}
long long nc2(long long v){return (v * (v - 1ll)) / 2ll;}
ll gcd(ll a, ll b) { return (b == 0 ? a : gcd(b, a % b)); }
ll lcm(ll a, ll b) { return (a * (b / gcd(a, b))); }
const int N = 10+2e5;
bool isprime(ll n) {
    if (n < 2) return 0;
    if (n == 2) return 1;
    if (n % 2 == 0) return 0;
    for (ll i = 3; i*i <= n; i++) if (n%i == 0) return 0;
    return 1;
}
double dist(pll p1, pll p2)
 {
    return (p1. F - p2.F)*(p1.F - p2.F) +
          (p1.S - p2.S)*(p1.S - p2.S);
 }
ll power(ll x,ll y)
{
    ll ans=1;
    while(y>0){
        if(y&1)
            ans=(ans*x)%M;
        x=(x*x);
        y/=2;
    }
    return ans%M;
}
int main()
{
    fast;
    ll n;
    cin>>n;
    pll a[n+1];
    ll cnt0=0;
    map<ll,ll>mp;
    repp(i,1,n)
	{
	  cin>>a[i].F;
	  a[i].S=i;
	  mp[a[i].F]++;
	}
	sort(a,a+n);
	vector<ll>ans(n+1);
	ll num=1;
    repp(i,1,n)
    {
        if(ans[a[i].S]) continue;
        ll b=n-a[i].F;
        if(mp[a[i].F]%b)
        {
           cout<<"Impossible";
           return 0;
		}
		repp(j,i,i+b-1)
		{
		   ans[a[j].S]=num;
		}
		num++;
	}
	repp(i,1,n) cout<<ans[i]<<" ";
}


#include<bits/stdc++.h>
using namespace std;
#define fast ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define rep(i,n) for(ll i=0;i<n;i++)
#define repp(i,a,b) for(ll i=a;i<=b;i++)
#define reff(i,a,b) for(ll i=a;i>=b;i--)
#define ll long long int
#define pll pair<ll,ll>
#define fill(a,x) memset(a,x,sizeof(a))
#define mb make_pair
#define pb push_back
#define F first
#define S second
#define M 1000000007
#define sc(x) scanf("%d",&x)
#define scc(x1,x2) scanf("%d%d",&x1,&x2)
#define sccc(x1,x2,x3) scanf("%d%d%d",&x1,&x2,&x3)
#define pr(x) printf("%lld ",x)
#define dbg(a)          std::cerr<<#a<<"="<<(a)<<"\n"
#define dbg1(a,b)       std::cerr<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<"\n"
#define dbg2(a,b,c)     std::cerr<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<"\n"
#define dbg3(a,b,c,d)   std::cerr<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<", "<<#d<<"="<<(d)<<"\n"
#define all(v) v.begin(),v.end()
#define PI 3.14159265
#define co cout<<"fuck"<<endl
const int INF = 2034567891;
const ll INF64 = 4234567890123456789ll;
long long nc3(long long v){return (v * (v - 1ll) * (v - 2ll)) / 6ll;}
long long nc2(long long v){return (v * (v - 1ll)) / 2ll;}
ll gcd(ll a, ll b) { return (b == 0 ? a : gcd(b, a % b)); }
ll lcm(ll a, ll b) { return (a * (b / gcd(a, b))); }
const int N = 10+2e5;
bool isprime(ll n) {
    if (n < 2) return 0;
    if (n == 2) return 1;
    if (n % 2 == 0) return 0;
    for (ll i = 3; i*i <= n; i++) if (n%i == 0) return 0;
    return 1;
}
double dist(pll p1, pll p2)
 {
    return (p1. F - p2.F)*(p1.F - p2.F) +
          (p1.S - p2.S)*(p1.S - p2.S);
 }
ll power(ll x,ll y)
{
    ll ans=1;
    while(y>0){
        if(y&1)
            ans=(ans*x)%M;
        x=(x*x);
        y/=2;
    }
    return ans%M;
}
int main()
{
    fast;
    ll n;
    cin>>n;
    pll a[n+1];
    ll cnt0=0;
    map<ll,ll>mp;
    repp(i,1,n)
	{
	  cin>>a[i].F;
	  a[i].S=i;
	  mp[a[i].F]++;
	}
	sort(a+1,a+n+1);
	vector<ll>ans(n+1,0);
	ll num=1;
    repp(i,1,n)
    {
        if(ans[a[i].S]) continue;
        ll b=n-a[i].F;
        if(mp[a[i].F]%b)
        {
           cout<<"Impossible";
           return 0;
		}
		repp(j,i,i+b-1)
		{
		   ans[a[j].S]=num;
		}
		num++;
	}
	cout<<"Possible"<<endl;
	repp(i,1,n) cout<<ans[i]<<" ";
}


#include<bits/stdc++.h>
using namespace std;
#define fast ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define rep(i,n) for(ll i=0;i<n;i++)
#define repp(i,a,b) for(ll i=a;i<=b;i++)
#define reff(i,a,b) for(ll i=a;i>=b;i--)
#define ll long long int
#define pll pair<ll,ll>
#define fill(a,x) memset(a,x,sizeof(a))
#define mb make_pair
#define pb push_back
#define F first
#define S second
#define M 1000000007
#define sc(x) scanf("%d",&x)
#define scc(x1,x2) scanf("%d%d",&x1,&x2)
#define sccc(x1,x2,x3) scanf("%d%d%d",&x1,&x2,&x3)
#define pr(x) printf("%lld ",x)
#define dbg(a)          std::cerr<<#a<<"="<<(a)<<"\n"
#define dbg1(a,b)       std::cerr<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<"\n"
#define dbg2(a,b,c)     std::cerr<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<"\n"
#define dbg3(a,b,c,d)   std::cerr<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<", "<<#d<<"="<<(d)<<"\n"
#define all(v) v.begin(),v.end()
#define PI 3.14159265
#define co cout<<"fuck"<<endl
const int INF = 2034567891;
const ll INF64 = 4234567890123456789ll;
long long nc3(long long v){return (v * (v - 1ll) * (v - 2ll)) / 6ll;}
long long nc2(long long v){return (v * (v - 1ll)) / 2ll;}
ll gcd(ll a, ll b) { return (b == 0 ? a : gcd(b, a % b)); }
ll lcm(ll a, ll b) { return (a * (b / gcd(a, b))); }
const int N = 10+2e5;
bool isprime(ll n) {
    if (n < 2) return 0;
    if (n == 2) return 1;
    if (n % 2 == 0) return 0;
    for (ll i = 3; i*i <= n; i++) if (n%i == 0) return 0;
    return 1;
}
double dist(pll p1, pll p2)
 {
    return (p1. F - p2.F)*(p1.F - p2.F) +
          (p1.S - p2.S)*(p1.S - p2.S);
 }
ll power(ll x,ll y)
{
    ll ans=1;
    while(y>0){
        if(y&1)
            ans=(ans*x)%M;
        x=(x*x);
        y/=2;
    }
    return ans%M;
}
int main()
{
    fast;
    ll n;
    cin>>n;
    pll a[n+1];
    ll cnt0=0;
    repp(i,1,n)
	{
	  cin>>a[i].F;
	  a[i].S=i;
	  if(a[i].F==0) cnt0++;
	}
    sort(a+1,a+n+1);
    reverse(a+1,a+n+1);
    if(n==1)
    {
       if(cnt0==1)
       {
        cout<<"Possible"<<endl;
        cout<<"1";
       }
       else
       cout<<"Impossible";
       return 0;
	}
	if(cnt0 && cnt0!=n)
	{
	   cout<<"Impossible";
	   return 0;
	}
	if(cnt0 && cnt0==n)
	{
	   cout<<"Possible";
	   cout<<endl;
	   repp(i,1,n) cout<<"1"<<" ";
	   return 0;
	}
	ll st=n-a[1].F;
	dbg(st);
	ll ans[n+1];
	ll cnt[n+1];
	fill(cnt,0);
	cnt[1]=a[1].F;
	repp(i,1,st)
	{
	   ans[i]=1;
	}
	repp(i,st+1,n)
	ans[i]=2;
	repp(i,2,n)
	{
	   // dbg1(i,ans[i]);
	    if(ans[i]==ans[i-1])
	    {
	       if(a[i].F==a[i-1].F)
	       {
		    cnt[i]=cnt[i-1];
	        continue;
	       }
	       else
	       {
	         cout<<"Impossible";
	         return 0;
		   }
		}
		if((i-1)>a[i].F)
		{
		  cout<<"Impossible";
		  return 0;
		}
		if((i-1)==a[i].F) continue;
		st=i+a[i].F-(i-1);
		//dbg(st);
		repp(j,st,n)
		ans[j]=ans[i]+1;
	}
	vector<ll>v(n+1);
	repp(i,1,n)
	{
	   v[a[i].S]=ans[i];
	}
	cout<<"Possible"<<endl;
	repp(i,1,v.size()-1)
	cout<<v[i]<<" ";
}


/*
 * ID: adityaa
 * LANG: C++
 */
#include <bits/stdc++.h>
using namespace std;

#define fio ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define mem(x, y) memset(x, y, sizeof x);
#define fi first
#define se second
#define pb push_back
#define pii pair<int , int>
#define asdfg y1
#define int long long
#define double long double
#define endl '\n'

/*-----------------------------------------------------------------------*/

#define TRACE

#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif

/*-----------------------------------------------------------------------*/

// check base cases n = 0 , n = 1
// max / min questions - check for binary search
const int maxn = (int) 1e6 + 6;
const double EPS = 1e-9;
const int INF = (int)1e18 + 18;
const int mod = (int)1e9 + 7;
int n , a[maxn];
map<int , int> mp;
int mn = INF , mx = -INF;

signed main() {

    fio;
    cin >> n;
    for(int i = 1; i <= n; i++){
        cin >> a[i];
        mn = min(mn , a[i]) , mx = max(mx , a[i]);
        mp[a[i]]++;
    }

    if(mn == mx){
        cout << "Possible" << endl;
        for(int i = 1; i <= n; i++){
            cout << i << " ";
        }
        cout << endl;
        return 0;
    }

    int sum = 0;
    for(auto it : mp){
        sum += it.second;
    }

    bool flag = true;
    for(int i = 1; i <= n; i++){
        int rem = sum - mp[a[i]];
        if(rem != a[i]){
            flag = false;
            break;
        }
    }

    if(flag){
        cout << "Possible" << endl;
        for(int i = 1; i <= n; i++){
            cout << a[i] + 1 << " ";
        }
        cout << endl;
    } else {
        cout << "Impossible" << endl;
    }

    return 0;

}


/*
 * ID: adityaa
 * LANG: C++
 */
#include <bits/stdc++.h>
using namespace std;

#define fio ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define mem(x, y) memset(x, y, sizeof x);
#define fi first
#define se second
#define pb push_back
#define pii pair<int , int>
#define asdfg y1
#define int long long
#define double long double
#define endl '\n'

/*-----------------------------------------------------------------------*/

#define TRACE

#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif

/*-----------------------------------------------------------------------*/

// check base cases n = 0 , n = 1
// max / min questions - check for binary search
const int maxn = (int) 1e6 + 6;
const double EPS = 1e-9;
const int INF = (int)1e18 + 18;
const int mod = (int) 998244353;
int n , a[maxn] , ans[maxn] , done[maxn];
vector<int> g[maxn];

signed main() {

    cin >> n;
    for(int i = 1; i <= n; i++){
        cin >> a[i];
        a[i] = n - a[i];
        g[a[i]].push_back(i);
    }

    int ptr = 1;
    for(int i = 1; i <= n; i++){
        if(done[a[i]]){
            continue;
        }

        if(g[a[i]].size() % a[i] != 0){
            cout << "Impossible" << endl;
            return 0;
        }

        for(int j = 0; j < g[a[i]].size(); j += a[i]){
            for(int k = 0; k < a[i]; k++){
                ans[g[a[i]][j + k]] = ptr;
            }
            ptr++;
        }
        done[a[i]] = 1;
    }

    cout << "Possible" << endl;
    for(int i = 1; i <= n; i++){
        cout << ans[i] << " ";
    }
    cout << endl;

    return 0;

}


/*
 * ID: adityaa
 * LANG: C++
 */
#include <bits/stdc++.h>
using namespace std;

#define fio ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define mem(x, y) memset(x, y, sizeof x);
#define fi first
#define se second
#define pb push_back
#define pii pair<int , int>
#define asdfg y1
#define int long long
#define double long double
#define endl '\n'

/*-----------------------------------------------------------------------*/

#define TRACE

#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif

/*-----------------------------------------------------------------------*/

// check base cases n = 0 , n = 1
// max / min questions - check for binary search
const int maxn = (int) 1e6 + 6;
const double EPS = 1e-9;
const int INF = (int)1e18 + 18;
const int mod = (int)1e9 + 7;
int n , a[maxn];
map<int , int> mp , exclude;

signed main() {

    fio;
    cin >> n;
    for(int i = 1; i <= n; i++){
        cin >> a[i];
        mp[a[i]]++;
    }

    int sum = 0;
    for(auto it : mp){
        sum += it.second;
    }

    bool flag = true;
    for(int i = 1; i <= n; i++){
        int rem = sum - mp[a[i]];
        if(rem != a[i]){
            flag = false;
            break;
        }
    }

    if(flag){
        cout << "Possible" << endl;
        for(int i = 1; i <= n; i++){
            cout << a[i] + 1 << " ";
        }
        cout << endl;
    } else {
        cout << "Impossible" << endl;
    }

    return 0;

}


/*
 * ID: adityaa
 * LANG: C++
 */
#include <bits/stdc++.h>
using namespace std;

#define fio ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define mem(x, y) memset(x, y, sizeof x);
#define fi first
#define se second
#define pb push_back
#define pii pair<int , int>
#define asdfg y1
#define int long long
#define double long double
#define endl '\n'

/*-----------------------------------------------------------------------*/

#define TRACE

#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif

/*-----------------------------------------------------------------------*/

// check base cases n = 0 , n = 1
// max / min questions - check for binary search
const int maxn = (int) 1e6 + 6;
const double EPS = 1e-9;
const int INF = (int)1e18 + 18;
const int mod = (int)1e9 + 7;
int n , a[maxn];
map<int , int> mp;

signed main() {

    fio;
    cin >> n;
    for(int i = 1; i <= n; i++){
        cin >> a[i];
        mp[a[i]]++;
    }

    if(n == 2){
        if(a[1] == 1 && a[2] == 1){
            cout << "Possible" << endl;
            cout << "1 2" << endl;
            return 0;
        }
    }

    int sum = 0;
    for(auto it : mp){
        sum += it.second;
    }

    bool flag = true;
    for(int i = 1; i <= n; i++){
        int rem = sum - mp[a[i]];
        if(rem != a[i]){
            flag = false;
            break;
        }
    }

    if(flag){
        cout << "Possible" << endl;
        for(int i = 1; i <= n; i++){
            cout << a[i] + 1 << " ";
        }
        cout << endl;
    } else {
        cout << "Impossible" << endl;
    }

    return 0;

}


/*
 * ID: adityaa
 * LANG: C++
 */
#include <bits/stdc++.h>
using namespace std;

#define fio ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define mem(x, y) memset(x, y, sizeof x);
#define fi first
#define se second
#define pb push_back
#define pii pair<int , int>
#define asdfg y1
#define int long long
#define double long double
#define endl '\n'

/*-----------------------------------------------------------------------*/

#define TRACE

#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif

/*-----------------------------------------------------------------------*/

// check base cases n = 0 , n = 1
// max / min questions - check for binary search
const int maxn = (int) 1e6 + 6;
const double EPS = 1e-9;
const int INF = (int)1e18 + 18;
const int mod = (int)1e9 + 7;
int n , a[maxn];
map<int , int> type;
int mn = INF , mx = -INF;

signed main() {

    fio;
    cin >> n;
    vector<int> b(n + 1);
    for(int i = 1; i <= n; i++){
        cin >> a[i];
        mn = min(mn , a[i]) , mx = max(mx , a[i]);
        b[i] = n - a[i];
    }

    if(mn == mx && mn == n - 1){
        cout << "Possible" << endl;
        for(int i = 1; i <= n; i++){
            cout << i << " ";
            if(i == n) cout << endl;
        }
        return 0;
    }

    int sum = 0;
    for(int i = 1; i <= n; i++){
        type[b[i]]++;
        sum++;
    }

    for(int i = 1; i <= n; i++){
        int hat = b[i];
        int remaining = sum - type[b[i]];
        if(remaining != a[i]){
            cout << "Impossible" << endl;
            return 0;
        }
    }

    cout << "Possible" << endl;
    for(int i = 1; i <= n; i++){
        cout << b[i] << " ";
        if(i == n){
            cout << endl;
        }
    }

    return 0;

}


/*
 * ID: adityaa
 * LANG: C++
 */
#include <bits/stdc++.h>
using namespace std;

#define fio ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define mem(x, y) memset(x, y, sizeof x);
#define fi first
#define se second
#define pb push_back
#define pii pair<int , int>
#define asdfg y1
#define int long long
#define double long double
#define endl '\n'

/*-----------------------------------------------------------------------*/

#define TRACE

#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif

/*-----------------------------------------------------------------------*/

// check base cases n = 0 , n = 1
// max / min questions - check for binary search
const int maxn = (int) 1e6 + 6;
const double EPS = 1e-9;
const int INF = (int)1e18 + 18;
const int mod = (int)1e9 + 7;
int n , a[maxn];
map<int , int> mp;
int mn = INF , mx = -INF;

signed main() {

    fio;
    cin >> n;
    for(int i = 1; i <= n; i++){
        cin >> a[i];
        mn = min(mn , a[i]) , mx = max(mx , a[i]);
        mp[a[i]]++;
    }

    if(mn == mx && mn == n - 1){
        cout << "Possible" << endl;
        for(int i = 1; i <= n; i++){
            cout << i << " ";
        }
        cout << endl;
        return 0;
    }

    int sum = 0;
    for(auto it : mp){
        sum += it.second;
    }

    bool flag = true;
    for(int i = 1; i <= n; i++){
        int rem = sum - mp[a[i]];
        if(rem != a[i]){
            flag = false;
            break;
        }
    }

    if(flag){
        cout << "Possible" << endl;
        for(int i = 1; i <= n; i++){
            cout << a[i] + 1 << " ";
        }
        cout << endl;
    } else {
        cout << "Impossible" << endl;
    }

    return 0;

}


/*
 * ID: adityaa
 * LANG: C++
 */
#include <bits/stdc++.h>
using namespace std;

#define fio ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define mem(x, y) memset(x, y, sizeof x);
#define fi first
#define se second
#define pb push_back
#define pii pair<int , int>
#define asdfg y1
#define int long long
#define double long double
#define endl '\n'

/*-----------------------------------------------------------------------*/

#define TRACE

#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif

/*-----------------------------------------------------------------------*/

// check base cases n = 0 , n = 1
// max / min questions - check for binary search
const int maxn = (int) 1e6 + 6;
const double EPS = 1e-9;
const int INF = (int)1e18 + 18;
const int mod = (int) 998244353;
int n , a[maxn] , ans[maxn] , done[maxn];
vector<int> g[maxn];

signed main() {

    cin >> n;
    for(int i = 1; i <= n; i++){
        cin >> a[i];
        a[i] = n - a[i];
        g[a[i]].push_back(i);
    }

    int ptr = 1;
    for(int i = 1; i <= n; i++){
        if(done[a[i]]){
            continue;
        }

        if(g[a[i]].size() % a[i] != 0){
            cout << "Impossible" << endl;
            return 0;
        }

        for(int j = 0; j < g[a[i]].size(); j++){
            int id = g[a[i]][j];
            ans[id] = ptr;
            if(g[a[i]].size() % (j + 1) == 0 && j){
                ptr++;
            }
        }
        done[a[i]] = 1;
    }

    cout << "Possible" << endl;
    for(int i = 1; i <= n; i++){
        cout << ans[i] << " ";
    }
    cout << endl;

    return 0;

}


/*
 * ID: adityaa
 * LANG: C++
 */
#include <bits/stdc++.h>
using namespace std;

#define fio ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define mem(x, y) memset(x, y, sizeof x);
#define fi first
#define se second
#define pb push_back
#define pii pair<int , int>
#define asdfg y1
#define int long long
#define double long double
#define endl '\n'

/*-----------------------------------------------------------------------*/

#define TRACE

#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif

/*-----------------------------------------------------------------------*/

// check base cases n = 0 , n = 1
// max / min questions - check for binary search
const int maxn = (int) 1e6 + 6;
const double EPS = 1e-9;
const int INF = (int)1e18 + 18;
const int mod = (int) 998244353;
int n , a[maxn] , ans[maxn] , done[maxn];
vector<int> g[maxn];

signed main() {

    cin >> n;
    for(int i = 1; i <= n; i++){
        cin >> a[i];
        a[i] = n - a[i];
        g[a[i]].push_back(i);
    }

    int ptr = 1;
    for(int i = 1; i <= n; i++){
        if(done[a[i]]){
            continue;
        }

        if(g[a[i]].size() % a[i] != 0){
            cout << "Impossible" << endl;
            return 0;
        }

        for(int j = 0; j < g[a[i]].size(); j++){
            int id = g[a[i]][j];
            ans[id] = ptr;
            if(g[a[i]].size() % (j + 1) == 0 && j){
                ptr++;
            }
        }
        done[a[i]] = 1;
        if(g[a[i]].size() == 1) ptr++;
    }

    cout << "Possible" << endl;
    for(int i = 1; i <= n; i++){
        cout << ans[i] << " ";
    }
    cout << endl;

    return 0;

}


    #include <bits/stdc++.h>
    #define FILES ifstream cin("input.txt"); ofstream cout("input.txt");
    #define FAST ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
    #define FIXED cout << fixed << setprecision(10)
    #define pb push_back
    #define pf push_front
    #define eps 1e-9
    #define mod 998244353
    #define f first
    #define s second
    using namespace std;

    typedef long long ll;
    typedef pair<ll, ll> pll;
    typedef  double ld;
    typedef vector <vector<ll> > graf;
    typedef pair< ld, ld> pld;
    int main () {
      FAST;
      ll n;
      cin>>n;
      vector<ll> a(n+1,0);
      for(ll i=1; i<=n; i++){
      cin>>a[i];
      a[i]=n-a[i];
      }
      ll col=1;
      map<ll,ll> ee;
      vector<ll> c(n+1,0);
      for(ll i=1; i<=n; i++) c[a[i]]++;
      for(ll i=1; i<=n; i++){
      if(c[i]!=0 && c[i]!=i) return cout<<"Impossible"<<endl,0;
      if(c[i]!=0) ee[i]=col,col++;
      }
      if(col>n+1)  return cout<<"Impossible"<<endl,0;
      cout<<"Possible"<<endl;
      for(ll i=1; i<=n; i++){
      cout<<ee[c[a[i]]]<<' ';
      }

    }


    #include <bits/stdc++.h>
    #define FILES ifstream cin("input.txt"); ofstream cout("input.txt");
    #define FAST ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
    #define FIXED cout << fixed << setprecision(10)
    #define pb push_back
    #define pf push_front
    #define eps 1e-9
    #define mod 998244353
    #define f first
    #define s second
    using namespace std;

    typedef long long ll;
    typedef pair<ll, ll> pll;
    typedef  double ld;
    typedef vector <vector<ll> > graf;
    typedef pair< ld, ld> pld;
    int main () {
      FAST;
      ll n;
      cin>>n;
      ll mn=1e17;

      vector<pll> a(n+1,{-90,0});
      for(ll i=1; i<=n; i++){
      cin>>a[i].f;
      a[i].f=n-a[i].f;
      a[i].s=i;
      }
      sort(a.begin(),a.end());
       ll dl=0,col=1,mx=0;
       if(n==2 && a[1].f==1 && a[2].f==2) return cout<<"Impossible"<<endl,0;
       vector<ll> ans(n+1,0);
      for(ll i=1; i<=n; i++){
       dl++;
      if(a[i].f==a[i-1].f) dl=dl;
      else  if(dl!=1 && i!=1) return cout<<"Impossible"<<endl,0;
      //cout<<dl<<' ';
      ans[a[i].s]=col;
      mx=col;
      if(dl==a[i].f) col++,dl=0;

      }
      //cout<<endl;
      if(mx>a[1].f+1) return cout<<"Impossible"<<endl,0;
      cout<<"Possible"<<endl;
      for(ll i=1; i<=n; i++){
      cout<<ans[i]<<' ';
      }

    }


    #include <bits/stdc++.h>
    #define FILES ifstream cin("input.txt"); ofstream cout("input.txt");
    #define FAST ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
    #define FIXED cout << fixed << setprecision(10)
    #define pb push_back
    #define pf push_front
    #define eps 1e-9
    #define mod 998244353
    #define f first
    #define s second
    using namespace std;

    typedef long long ll;
    typedef pair<ll, ll> pll;
    typedef  double ld;
    typedef vector <vector<ll> > graf;
    typedef pair< ld, ld> pld;
    int main () {
      FAST;
      ll n;
      cin>>n;
      ll mn=1e17;
      vector<pll> a(n+1,{-90,0});
      for(ll i=1; i<=n; i++){
      cin>>a[i].f;
      a[i].f=n-a[i].f;
      a[i].s=i;
      }
      sort(a.begin(),a.end());
       ll dl=0,col=1;
       vector<ll> ans(n+1,0);
      for(ll i=1; i<=n; i++){
       dl++;
      if(a[i].f==a[i-1].f) dl=dl;
      else  if(dl!=1 && i!=1) return cout<<"Impossible"<<endl,0;
      //cout<<dl<<' ';
      ans[a[i].s]=col;
      if(dl==a[i].f) col++,dl=0;

      }
      //cout<<endl;
      if(col>a[1].s) return cout<<"Impossible"<<endl,0;
      cout<<"Possible"<<endl;
      for(ll i=1; i<=n; i++){
      cout<<ans[i]<<' ';
      }

    }


    #include <bits/stdc++.h>
    #define FILES ifstream cin("input.txt"); ofstream cout("input.txt");
    #define FAST ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
    #define FIXED cout << fixed << setprecision(10)
    #define pb push_back
    #define pf push_front
    #define eps 1e-9
    #define mod 998244353
    #define f first
    #define s second
    using namespace std;

    typedef long long ll;
    typedef pair<ll, ll> pll;
    typedef  double ld;
    typedef vector <vector<ll> > graf;
    typedef pair< ld, ld> pld;
    int main () {
      FAST;
      ll n;
      cin>>n;
      vector<ll> a(n+1,0);
      for(ll i=1; i<=n; i++){
      cin>>a[i];
      a[i]=n-a[i];
      }
      ll col=1;
      map<ll,ll> ee;
      vector<ll> c(n+1,0);
      for(ll i=1; i<=n; i++) c[a[i]]++;
      for(ll i=1; i<=n; i++){
      if(c[i]!=0 && c[i]!=i) return cout<<"Impossible"<<endl,0;
      if(c[i]!=0) ee[i]=col,col++;
      }

      cout<<"Possible"<<endl;
      for(ll i=1; i<=n; i++){
      cout<<ee[c[a[i]]]<<' ';
      }

    }


    #include <bits/stdc++.h>
    #define FILES ifstream cin("input.txt"); ofstream cout("input.txt");
    #define FAST ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
    #define FIXED cout << fixed << setprecision(10)
    #define pb push_back
    #define pf push_front
    #define eps 1e-9
    #define mod 998244353
    #define f first
    #define s second
    using namespace std;

    typedef long long ll;
    typedef pair<ll, ll> pll;
    typedef  double ld;
    typedef vector <vector<ll> > graf;
    typedef pair< ld, ld> pld;
    int main () {
      FAST;
      ll n;
      cin>>n;
      ll mn=1e17;
      vector<pll> a(n+1,{-90,0});
      for(ll i=1; i<=n; i++){
      cin>>a[i].f;
      a[i].f=n-a[i].f;
      a[i].s=i;
      }
      sort(a.begin(),a.end());
       ll dl=0,col=1,mx=0;
       vector<ll> ans(n+1,0);
      for(ll i=1; i<=n; i++){
       dl++;
      if(a[i].f==a[i-1].f) dl=dl;
      else  if(dl!=1 && i!=1) return cout<<"Impossible"<<endl,0;
      //cout<<dl<<' ';
      ans[a[i].s]=col;
      mx=col;
      if(dl==a[i].f) col++,dl=0;

      }
      //cout<<endl;
      if(mx>a[1].f) return cout<<"Impossible"<<endl,0;
      cout<<"Possible"<<endl;
      for(ll i=1; i<=n; i++){
      cout<<ans[i]<<' ';
      }

    }


    #include <bits/stdc++.h>
    #define FILES ifstream cin("input.txt"); ofstream cout("input.txt");
    #define FAST ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
    #define FIXED cout << fixed << setprecision(10)
    #define pb push_back
    #define pf push_front
    #define eps 1e-9
    #define mod 998244353
    #define f first
    #define s second
    using namespace std;

    typedef long long ll;
    typedef pair<ll, ll> pll;
    typedef  double ld;
    typedef vector <vector<ll> > graf;
    typedef pair< ld, ld> pld;
    int main () {
      FAST;
      ll n;
      cin>>n;
      ll mn=1e17;
      vector<pll> a(n+1,{-90,0});
      for(ll i=1; i<=n; i++){
      cin>>a[i].f;
      a[i].f=n-a[i].f;
      a[i].s=i;
      }
      sort(a.begin(),a.end());
       ll dl=0,col=1;
       vector<ll> ans(n+1,0);
      for(ll i=1; i<=n; i++){
       dl++;
      if(a[i].f==a[i-1].f) dl=dl;
      else  if(dl!=1 && i!=1) return cout<<"Impossible"<<endl,0;
      //cout<<dl<<' ';
      ans[a[i].s]=col;
      if(dl==a[i].f) col++,dl=0;

      }
      //cout<<endl;
      if(col>a[1].f) return cout<<"Impossible"<<endl,0;
      cout<<"Possible"<<endl;
      for(ll i=1; i<=n; i++){
      cout<<ans[i]<<' ';
      }

    }


    #include <bits/stdc++.h>
    #define FILES ifstream cin("input.txt"); ofstream cout("input.txt");
    #define FAST ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
    #define FIXED cout << fixed << setprecision(10)
    #define pb push_back
    #define pf push_front
    #define eps 1e-9
    #define mod 998244353
    #define f first
    #define s second
    using namespace std;

    typedef long long ll;
    typedef pair<ll, ll> pll;
    typedef  double ld;
    typedef vector <vector<ll> > graf;
    typedef pair< ld, ld> pld;
    int main () {
      FAST;
      ll n;
      cin>>n;
      ll mn=1e17;
      vector<pll> a(n+1,{-90,0});
      for(ll i=1; i<=n; i++){
      cin>>a[i].f;
      a[i].f=n-a[i].f;
      a[i].s=i;
      }
      sort(a.begin(),a.end());
       ll dl=0,col=1,mx=0;
       vector<ll> ans(n+1,0);
      for(ll i=1; i<=n; i++){
       dl++;
      if(a[i].f==a[i-1].f) dl=dl;
      else  if(dl!=1 && i!=1) return cout<<"Impossible"<<endl,0;
      //cout<<dl<<' ';
      ans[a[i].s]=col;
      if(dl==a[i].f) col++,dl=0;

      }
      //cout<<endl;
      if(col>n) return cout<<"Impossible"<<endl,0;
      cout<<"Possible"<<endl;
      for(ll i=1; i<=n; i++){
      cout<<ans[i]<<' ';
      }

    }


    #include <bits/stdc++.h>
    #define FILES ifstream cin("input.txt"); ofstream cout("input.txt");
    #define FAST ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
    #define FIXED cout << fixed << setprecision(10)
    #define pb push_back
    #define pf push_front
    #define eps 1e-9
    #define mod 998244353
    #define f first
    #define s second
    using namespace std;

    typedef long long ll;
    typedef pair<ll, ll> pll;
    typedef  double ld;
    typedef vector <vector<ll> > graf;
    typedef pair< ld, ld> pld;
    int main () {
      FAST;
      ll n;
      cin>>n;
      ll mn=1e17;

      vector<pll> a(n+1,{-90,0});
      for(ll i=1; i<=n; i++){
      cin>>a[i].f;
      a[i].f=n-a[i].f;
      a[i].s=i;
      }
      sort(a.begin(),a.end());
       ll dl=0,col=1,mx=0;
       //if(n==2 && a[1].f==1 && a[2].f==2) return cout<<"Impossible"<<endl,0;
       vector<ll> ans(n+1,0);
      for(ll i=1; i<=n; i++){
       dl++;
      if(a[i].f==a[i-1].f) dl=dl;
      else  if(dl!=1 && i!=1) return cout<<"Impossible"<<endl,0;
      //cout<<dl<<' ';
      ans[a[i].s]=col;
      mx=col;
      if(dl==a[i].f) col++,dl=0;

      }
      //cout<<endl;
      if(/*mx>a[1].f+1 ||*/ dl!=0) return cout<<"Impossible"<<endl,0;
      cout<<"Possible"<<endl;
      for(ll i=1; i<=n; i++){
      cout<<ans[i]<<' ';
      }

    }


    #include <bits/stdc++.h>
    #define FILES ifstream cin("input.txt"); ofstream cout("input.txt");
    #define FAST ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
    #define FIXED cout << fixed << setprecision(10)
    #define pb push_back
    #define pf push_front
    #define eps 1e-9
    #define mod 998244353
    #define f first
    #define s second
    using namespace std;

    typedef long long ll;
    typedef pair<ll, ll> pll;
    typedef  double ld;
    typedef vector <vector<ll> > graf;
    typedef pair< ld, ld> pld;
    int main () {
      FAST;
      ll n;
      cin>>n;
      ll mn=1e17;

      vector<pll> a(n+1,{-90,0});
      for(ll i=1; i<=n; i++){
      cin>>a[i].f;
      a[i].f=n-a[i].f;
      a[i].s=i;
      }
      sort(a.begin(),a.end());
       ll dl=0,col=1,mx=0;
       //if(n==2 && a[1].f==1 && a[2].f==2) return cout<<"Impossible"<<endl,0;
       vector<ll> ans(n+1,0);
      for(ll i=1; i<=n; i++){
       dl++;
      if(a[i].f==a[i-1].f) dl=dl;
      else  if(dl!=1 && i!=1) return cout<<"Impossible"<<endl,0;
      //cout<<dl<<' ';
      ans[a[i].s]=col;
      mx=col;
      if(dl==a[i].f) col++,dl=0;

      }
      //cout<<endl;
      if(mx>a[1].f+1 || dl!=0) return cout<<"Impossible"<<endl,0;
      cout<<"Possible"<<endl;
      for(ll i=1; i<=n; i++){
      cout<<ans[i]<<' ';
      }

    }


    #include <bits/stdc++.h>
    #define FILES ifstream cin("input.txt"); ofstream cout("input.txt");
    #define FAST ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
    #define FIXED cout << fixed << setprecision(10)
    #define pb push_back
    #define pf push_front
    #define eps 1e-9
    #define mod 998244353
    #define f first
    #define s second
    using namespace std;

    typedef long long ll;
    typedef pair<ll, ll> pll;
    typedef  double ld;
    typedef vector <vector<ll> > graf;
    typedef pair< ld, ld> pld;
    int main () {
      FAST;
      ll n;
      cin>>n;
      ll mn=1e17;
      vector<pll> a(n+1,{-90,0});
      for(ll i=1; i<=n; i++){
      cin>>a[i].f;
      a[i].f=n-a[i].f;
      a[i].s=i;
      }
      sort(a.begin(),a.end());
       ll dl=0,col=1,mx=0;
       vector<ll> ans(n+1,0);
      for(ll i=1; i<=n; i++){
       dl++;
      if(a[i].f==a[i-1].f) dl=dl;
      else  if(dl!=1 && i!=1) return cout<<"Impossible"<<endl,0;
      //cout<<dl<<' ';
      ans[a[i].s]=col;
      mx=col;
      if(dl==a[i].f) col++,dl=0;

      }
      //cout<<endl;
      if(mx>a[1].f+1) return cout<<"Impossible"<<endl,0;
      cout<<"Possible"<<endl;
      for(ll i=1; i<=n; i++){
      cout<<ans[i]<<' ';
      }

    }


#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <bitset>
#include <list>

using namespace std;

using ll = long long;
using ld = long double;

int n;
vector<int> cnt, a;

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

    cin >> n;
    cnt.resize(n + 1);
    a.resize(n);

    for (int i = 0; i < n; ++i) {
        cin >> a[i];
        a[i] = n - a[i];
        cnt[a[i]]++;
    }

    for (int i = 0; i <= n; ++i) {
        if (!(cnt[i] == i || cnt[i] == 0)) {
            cout << "Impossible";
            return 0;
        }
    }

    cout << "Possible\n";
    for (int i = 0; i < n; ++i)
        cout << a[i] << ' ';

    return 0;
}


#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <bitset>
#include <list>

using namespace std;

using ll = long long;
using ld = long double;

int n;
vector<ll> a;
vector<vector<ll>> cnt;

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

    cin >> n;
    cnt.resize(n + 1);
    a.resize(n);

    for (int i = 0; i < n; ++i) {
        cin >> a[i];
        a[i] = n - a[i];
        cnt[a[i]].push_back(i);
    }

    ll cur = 0;
    for (int i = 1; i <= n; ++i) {
        cur += (cnt[i].size() != 0) * i;
    }
    if (cur > n) {
        cout << "Impossible";
        return 0;
    }

    cout << "Possible\n";

    int hat = 0;
    vector<ll> ans(n);
    for (int i = 1; i <= n; ++i) {
        if (cnt[i].size() == 0)
            continue;
        int used = 0;
        for (int j = 0; j < cnt[i].size(); ++j) {
            if (used % i == 0)
                hat++;
            ans[cnt[i][j]] = hat;
            used++;
        }
    }
    for (int i = 0; i < n; ++i)
        cout << ans[i] << ' ';

    return 0;
}


#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <bitset>
#include <list>

using namespace std;

using ll = long long;
using ld = long double;

int n;
vector<ll> a;
vector<vector<ll>> cnt;

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

    cin >> n;
    cnt.resize(n + 1);
    a.resize(n);

    for (int i = 0; i < n; ++i) {
        cin >> a[i];
        a[i] = n - a[i];
        cnt[a[i]].push_back(i);
    }

    ll cur = 0;
    for (int i = 1; i <= n; ++i) {
        cur += ((cnt[i].size() + i - 1) / i) * i;
    }
    if (cur > n) {
        cout << "Impossible";
        return 0;
    }

    cout << "Possible\n";

    int hat = 0;
    vector<ll> ans(n);
    for (int i = 1; i <= n; ++i) {
        if (cnt[i].size() == 0)
            continue;
        int used = 0;
        for (int j = 0; j < cnt[i].size(); ++j) {
            if (used % i == 0)
                hat++;
            ans[cnt[i][j]] = hat;
            used++;
        }
    }
    for (int i = 0; i < n; ++i)
        cout << ans[i] << ' ';

    return 0;
}


#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <bitset>
#include <list>

using namespace std;

using ll = long long;
using ld = long double;

int n;
vector<int> cnt, a;

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

    cin >> n;
    cnt.resize(n + 1);
    a.resize(n);

    for (int i = 0; i < n; ++i) {
        cin >> a[i];
        a[i] = n - a[i];
        cnt[a[i]]++;
    }

    int cur = 0;
    for (int i = 1; i <= n; ++i) {
        cur += (cnt[i] != 0) * i;
    }
    if (cur > n) {
        cout << "Impossible";
        return 0;
    }

    cout << "Possible\n";

    int hat = 1;
    vector<int> used(n + 1, 0);
    for (int i = 0; i < n; ++i) {
        cout << hat << ' ';
        used[cnt[a[i]]]++;
        if (used[cnt[a[i]]] == a[i]) {
            used[cnt[a[i]]] = 0;
            hat++;
        }
    }

    return 0;
}


#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <bitset>
#include <list>

using namespace std;

using ll = long long;
using ld = long double;

int n;
vector<ll> cnt, a;

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

    cin >> n;
    cnt.resize(n + 1);
    a.resize(n);

    for (int i = 0; i < n; ++i) {
        cin >> a[i];
        a[i] = n - a[i];
        cnt[a[i]]++;
    }

    ll cur = 0;
    for (int i = 1; i <= n; ++i) {
        cur += (cnt[i] != 0) * i;
    }
    if (cur > n) {
        cout << "Impossible";
        return 0;
    }

    cout << "Possible\n";

    int hat = 1;
    vector<ll> used(n + 1, 0);
    for (int i = 0; i < n; ++i) {
        cout << hat << ' ';
        used[cnt[a[i]]]++;
        if (used[cnt[a[i]]] == a[i]) {
            used[cnt[a[i]]] = 0;
            hat++;
        }
    }

    return 0;
}


#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <bitset>
#include <list>

using namespace std;

using ll = long long;
using ld = long double;

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

    int n;
    vector<int> cnt, a;

    cin >> n;
    cnt.resize(n);
    a.resize(n);

    for (int i = 0; i < n; ++i) {
        cin >> a[i];
        a[i] = n - a[i];
        cnt[a[i]]++;
    }

    for (int i = 0; i < n; ++i) {
        if (!(cnt[i] == i || cnt[i] == 0)) {
            cout << "Impossible";
            return 0;
        }
    }

    cout << "Possible\n";
    for (int i = 0; i < n; ++i)
        cout << a[i] << ' ';

    return 0;
}