#include using namespace std; #define N 100007 #define p 1000000007 #define LL long long struct node { int x, id, next, pre; } a[N]; vector E[N * 2]; int ans[N * 2]; priority_queue > q; int main() { a[0].x = -N; int T, n, x, cnt; scanf("%d", &T); while (T--) { scanf("%d", &n); for(int i = 1; i <= n; i++) { scanf("%d", &x); a[i].x = x; a[i].id = i; a[i].next = i + 1; a[i].pre = i - 1; } cnt = n; for(int i = 1; i <= n + n; i++) { E[i].clear(); } a[0].next = 1; a[n + 1].x = -N; a[n + 1].pre = n; int now = 1; while (now < n) { if (a[now].x != a[a[now].next].x) { now = a[now].next; continue; } cnt++; E[cnt].push_back(a[now].id); E[cnt].push_back(a[a[now].next].id); ans[cnt] = now; a[now].x--; now = a[now].pre; a[now].next = a[a[now].next].next; a[a[now].next].pre = now; a[a[now].next].x--; a[a[now].next].id = cnt; } if (a[n].x != 0 || a[n].pre != 0) printf("Impossible\n"); else { printf("Possible\n"); while (!q.empty()) q.pop(); q.push(make_pair(-ans[cnt], cnt)); bool check = false; while (!q.empty()) { if (check) printf(" "); check = true; printf("%d", -q.top().first); x = q.top().second; q.pop(); for (int j = 0; j < E[x].size(); j++) { if (E[x][j] > n) { q.push(make_pair(-ans[E[x][j]], E[x][j])); } } } printf("\n"); } } return 0; }