#include<stdio.h>
int main()
{
    int a=0,p,q,r;
    int x[100],y[100],z[100];
    scanf("%d",&a);
    for(int i=0;i<a;i++)
    {
        scanf("%d %d %d",x[i],y[i],z[i]);
    }
    for(int i=0;i<a-1;i++)
    {
        for(int j=i+1;j<a;j++)
        {
            if(z[i]<z[j])
            {
                p=z[i];
                q=y[i];
                r=x[i];
                z[i]=z[j];
                y[i]=y[j];
                x[i]=x[j];
                z[j]=p;
                y[j]=q;
                x[j]=r;
            }
        }
    }
    if(x[0]==x[1]==x[3])
    {
        x[3]=x[4];
        y[3]=y[4];
    }
    for(int i=0;i<3;i++)
    {
        printf("%d %d",x[i],y[i]);
    }
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: