//////////////////////////////////////////////////////////////////
//Color Me Less
//最接近颜色点
#include<iostream.h>
#include<math.h>
int shu[16][3];
int i,j;
void shuru()
{
for(i=0;i<16;i++)
for(j=0;j<3;j++)
cin>>shu[i][j];
}
int main()
{
int x,y,z,tem,wei,dis;
shuru();
while( (cin>>x>>y>>z) && !((x==-1)&&(y==-1)&&(z==-1)) ) //不能写成……&&!(x==y==z==-1)……
{
dis=200000;
for(i=0;i<16;i++)
{
tem=pow(x-shu[i][0],2)+pow(y-shu[i][1],2)+pow(z-shu[i][2],2);
if(tem<dis)
{
dis=tem;
wei=i;
}
}
cout<<"("<<x<<","<<y<<","<<z<<")"<<" maps to ("
<<shu[wei][0]<<","<<shu[wei][1]<<","<<shu[wei][2]
<<")"<<endl;
}
return 0;
}