/* 1/radius of the circle passing thought 3 points */
double getCurvatureCircle(Point P1, Point P2, Point P3)
{
    if(P1==P2 || P2==P3 || P1==P3)
        return 0;

    double a,b,c,p,pa,pb,pc,S;
    a = distancePoints(P1,P2);
    b = distancePoints(P2,P3);
    c = distancePoints(P3,P1);
    //cout<<"a = "<<a<<" b = "<<b<<" c = "<<c<<endl;

    p=a+b+c;
    pa=b+c-a;
    pb=a+c-b;
    pc=a+b-c;
    S=sqrt(p*pa*pb*pc);

    double radius, curvature=0;
    if (S!=0)
    {
        radius=a*b*c/S;
        curvature=(double) 1/radius;
        //if(isLeft(P2,P3,P1)<0) curvature=-curvature;
        if(isLeft(P1,P2,P3)<0) curvature=-curvature;
    }
    //else
    //    curvature = 1e-6;

    return curvature;
}
// angle between three points (p1,p2,p3) = (b,c,a)
//c*c = a*a + b*b - 2abcos(alpha)
double relativeAngle(Point p1, Point p2, Point p3)
{
    if(p1 == p2 || p1 == p3 || p2==p3)
        return 0;
    double a, b, c, ac;
    a = distancePoints(p1,p2);
    b = distancePoints(p2,p3);
    c = distancePoints(p1,p3);
    ac = (c*c-a*a-b*b);
    if(fabs(ac)<1e-6)
        return M_PI/2;
    if(fabs(c-a-b)<1e-6)
        return M_PI;
    //ac=(c*c-a*a-b*b)/(-2*a*b);
    return acos(ac/(-2*a*b));
}
int main(){
    std::string input = "";
    int count = 0;
    std::getline(std::cin, input);
    count = std::stoi(input);
    std::vector<double> firstSet[count];
    std::vector<double> secondSet[count];
    std::string results[count];
    for(unsigned int i = 0; i < count; ++ i){
	std::getline(std::cin, input);	
	firstSet[i] = pointToVector(input);
    }
    for(unsigned int i = 0; i < count; ++ i){
	std::getline(std::cin, input);
	secondSet[i] = pointToVector(input);
    }
    for(unsigned int i = 0; i < count; ++ i){
	std::string temp = std::to_string(i) + ",";
	double distance = -1;
	unsigned int index = 0;
	for(unsigned int k = 0; k < count; ++ k){
	    double tempDistance = distancePoints(firstSet[i], secondSet[k]);
	    if(distance < 0 || distance > tempDistance){
		index = k;
		distance = tempDistance;
	    }
	}
	std::cout << temp << index << std::endl;
    }
    return 0;
}
double lengthContour(const vector<Point>& contour)
{
    double length = 0;
    for(vector<Point>::const_iterator it = contour.begin(); it+1 != contour.end(); it++)
        //cout<<"length "<<distancePoints(*it,*(it+1))<<endl;
        length += distancePoints(*it,*(it+1));
    return length;
}
double lengthContour(const vector<Point>& contour, Point p1, Point p2)
{
    double length = 0;
    int indexP1 = findElement(contour,p1);
    int indexP2 = findElement(contour,p2);
    if(indexP1 != -1 && indexP2 != -1)
        for(int it = indexP1; it < indexP2; it++)
            length += distancePoints(contour.at(it),contour.at(it+1));
    return length;
}
double getCurvatureRatio(Point P1, Point P2, Point P3)
{
    if(P1==P2 || P2==P3 || P1==P3)
        return 0;

    double l = distancePoints(P2,P3);
    double d = distancePointSegment(P1,P2,P3);
    double curvature=d/l;
    //if(isLeft(P2,P3,P1)<0) curvature=-curvature;
    if(isLeft(P1,P2,P3)<0) curvature=-curvature;

    return curvature;
}
double determineRadius(Point center, Point p)
{
    return distancePoints(center,p);
}
double determineRadius(Point p1, Point p2, Point p3)
{
    Point center = determineCenter(p1,p2,p3);
    return (distancePoints(p1,center) + distancePoints(p2,center) + distancePoints(p3,center))/3.0;
}
double signedDistancePointCircle(Point p, Point center, double radius)
{
    return distancePoints(p,center) - radius;
}
double distancePointCircle(Point p, Point center, double radius)
{
    return fabs(distancePoints(p,center) - radius);
}