var
f,a,d:array[1..10000]of longint;
l,r,x,i,j,n,s,t,m:longint;
begin
assign(input,'lis.in');
assign(output,'lis.out');
rewrite(output);
reset(input);
read(n);
for i:=1 to n do
read(a[i]);
f[n]:=1;
d[1]:=a[n];
s:=1;
for i:=n-1 downto 1 do
begin
l:=1;
r:=s;
m:=(l+r+1)>>1;
while l<r do
begin
if d[m]>a[i] then l:=m
else r:=m-1;
m:=(l+r+1)>>1;
end;
if d[m]>a[i] then
begin
f[i]:=m+1;
if s<m+1 then begin s:=m+1; d[s]:=a[i]; end
else if d[m+1]<a[i] then d[m+1]:=a[i];
end;
end;
{for i:=1 to n do
write(f[i],' ');}
read(m);
for j:=1 to m do begin
read(x);
if (x<=0)or(x>s) then writeln('Impossible')
else
begin
i:=1; t:=-maxlongint;
while (x>0)and(i<=n) do
begin
if (f[i]>=x)and(a[i]>t) then
begin write(a[i],' '); t:=a[i]; dec(x); end;
inc(i);
end;
writeln; //writeln(j);writeln;
end;
end;
close(input);
close(output);
end.