![](https://img-blog.csdn.net/20141108150419707?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvbHVja2lseXdt/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center)
#include<stdio.h>
#include<algorithm>
using namespace std;
int main()
{
int n;
while(scanf("%d",&n)!=EOF)
{
int i,k;
char c[5];
int a[100001],b[101];
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
sort(a,a+n);
scanf("%s",c);
scanf("%d",&k);
for (i=0;i<k;i++)
{
scanf("%d",&b[i]);
}
for (i=0;i<k;i++)
{
printf("%d\n",a[b[i]-1]);
}
}
return 0;
}