#include<iostream>
using namespace std;
int main()
{
string hand[11],eye[11],mouth[11];
string str,out="";
int i,n,hands=0,eyes=0,mouths=0,flag=0;
int s1,s2,s3,s4,s5;
getline(cin,str);
flag=0;
for(i=0;i<str.length();i++)
{
if(str[i]==']')
{
flag=0;
hands++;
}
if(flag==1)
{
hand[hands].push_back(str[i]);
}
if(str[i]=='[')
{
flag=1;
}
}
flag=0;
getline(cin,str);
for(i=0;i<str.length();i++)
{
if(str[i]==']')
{
flag=0;
eyes++;
}
if(flag==1)
{
eye[eyes].push_back(str[i]);
}
if(str[i]=='[')
{
flag=1;
}
}
flag=0;
getline(cin,str);
for(i=0;i<str.length();i++)
{
if(str[i]==']')
{
flag=0;
mouths++;
}
if(flag==1)
{
mouth[mouths].push_back(str[i]);
}
if(str[i]=='[')
{
flag=1;
}
}
cin>>n;
for(i=0;i<n;i++)
{
out.clear();
cin>>s1>>s2>>s3>>s4>>s5;
if(s1<=hands&&s1>0)
{
out=out+hand[s1-1]+'(';
}
else
{
cout<<"Are you kidding me? @\\/@"<<endl;
continue;
}
if(s2<=eyes&&s2>0)
{
out=out+eye[s2-1];
}
else
{
cout<<"Are you kidding me? @\\/@"<<endl;
continue;
}
if(s3<=mouths&&s3>0)
{
out=out+mouth[s3-1];
}
else
{
cout<<"Are you kidding me? @\\/@"<<endl;
continue;
}
if(s4<=eyes&&s4>0)
{
out=out+eye[s4-1]+')';
}
else
{
cout<<"Are you kidding me? @\\/@"<<endl;
continue;
}
if(s5<=hands&&s5>0)
{
out=out+hand[s5-1];
}
else
{
cout<<"Are you kidding me? @\\/@"<<endl;
continue;
}
cout<<out<<endl;
}
}