#include<iostream> #include<cstdio> #define MAX_N 10000 usingnamespace std; int n, m, k, a[MAX_N+5], f[MAX_N+5]; voidprint(){ for (int i = 1, pre = 0; i <= n; i++) if (f[i] >= k && a[i] > pre) { printf("%d", a[i]), pre = a[i]; if (--k) printf(" "); elsebreak; } if (k) printf("Impossible"); printf("\n"); } intmain(){ scanf("%d", &n); for (int i = 1; i <= n; i++) scanf("%d", &a[i]), f[i] = 1; for (int i = n; i >= 1; i--) for (int j = i+1; j <= n; j++) if (a[i] < a[j]) f[i] = max(f[i], f[j]+1); scanf("%d", &m); while (m--) scanf("%d", &k), print(); return0; }