#include <stdio.h>
int main()
{
char hand[10][6]={0},eye[10][6]={0},mouth[10][6]={0},c;
int i=0,n,a1,a2,a3,a4,a5;
while((c=getchar())!='\n')
if(c=='[')
scanf("%[^]]",hand[i++]);
i=0;
while((c=getchar())!='\n')
if(c=='[')
scanf("%[^]]",eye[i++]);
i=0;
while((c=getchar())!='\n')
if(c=='[')
scanf("%[^]]",mouth[i++]);
scanf("%d",&n);
while(n--)
{
scanf("%d %d %d %d %d",&a1,&a2,&a3,&a4,&a5);
a1--;a2--;a3--;a4--;a5--;
if( a1>9 || a1<0 || !(*hand[a1]) ||
a2>9 || a2<0 || !(*eye[a2]) ||
a3>9 || a3<0 || !(*mouth[a3]) ||
a4>9 || a4<0 || !(*eye[a4]) ||
a5>9 || a5<0 || !(*hand[a5]) )
puts("Are you kidding me? @\\/@");
else
printf("%s(%s%s%s)%s\n",hand[a1],eye[a2],mouth[a3],eye[a4],hand[a5]);
}
system("pause");
return 0;
}