#include <iostream>
using namespace std;
int main(){
int largeSet[16][3];
for(int i=0;i<16;i++){
cin>>largeSet[i][0];
cin>>largeSet[i][1];
cin>>largeSet[i][2];
//cout<<largeSet[i][0]<<" "<<largeSet[i][1]<<" "<<largeSet[i][2]<<endl;
}
int x,y,z;
cin>>x;
cin>>y;
cin>>z;
int temp;
int tx,ty,tz;
while(x!=-1){
//cout<<x<<" "<<y<<" "<<z<<endl;
int min=256*256*3;
for(int i=0;i<16;i++){
temp=(x-largeSet[i][0])*(x-largeSet[i][0])+(y-largeSet[i][1])*(y-largeSet[i][1])+(z-largeSet[i][2])*(z-largeSet[i][2]);
if(temp<min){
min=temp;
tx=largeSet[i][0];
ty=largeSet[i][1];
tz=largeSet[i][2];
}
}
cout<<"("<<x<<","<<y<<","<<z<<") maps to ("<<tx<<","<<ty<<","<<tz<<")"<<endl;
cin>>x;
cin>>y;
cin>>z;
}
return 0;
}