#include const int MAXN = 100005; int n; int a[MAXN], pre[MAXN], nxt[MAXN], ans[MAXN]; int read() { int p = 0; char c = getchar(); while (c < '0' || c > '9') c = getchar(); while (c >= '0' && c <= '9') p = p * 10 + (c - '0'), c = getchar(); return p; } int main() { int T; T = read(); while(T--) { n = read(); for(int i = 1; i <= n; i++) { a[i] = read(); pre[i] = i - 1, nxt[i] = i + 1; } a[0] = a[n + 1] = 0; pre[n + 1] = n, nxt[0] = 1; int now = n; bool tf = true; for(int i = n - 1; i >= 1; i--) { //printf("%d %d\n", now, pre[now]); while (now > 1 && a[now] != a[pre[now]]) now = pre[now]; if (now == 1) { tf = false; break; } ans[i] = pre[now]; a[now]--; pre[now] = pre[pre[now]]; nxt[pre[now]] = now; //for(int i = 1; i <= n; i++) printf("%d ", nxt[i]); //printf("\n"); //for(int i = 1; i <= n; i++) printf("%d ", pre[i]); //printf("\n"); if (i > 1 && a[now] == 0) { tf = false; break; } if (i == 1 && a[now] != 0) tf = false; now = nxt[now]; } if (!tf) printf("Impossible\n"); else { printf("Possible\n"); printf("%d", ans[1]); for(int i = 2; i <= n - 1; i++) printf(" %d", ans[i]); printf("\n"); } } return 0; }