#include <stdio.h>

struct h
{
    
}

int main() {
    int n;
    int a, b, c;
    int at=0, bt=0, ct=0;
    int a3=0. b3=0, c3=0, a2=0. b2=0, c2=0, a1=0. b1=0, c1=0,
    scanf("%d",&n);
    for(int i=0; i<n; i++)
    {
        scanf("%d %d %d", &a, &b, &c);
        if(a==3)
        {
            a3++;
        }
        if(a==2)
        {
            a2++;
        }
        if(b==3)
        {
            b3++;
        }
        if(b==2)
        {
            b2++;
        }
        if(c==3)
        {
            c3++;
        }
        if(c==2)
        {
            c2++;
        }
        at=at+a;
        bt=bt+b;
        ct=ct+c;
    }
    printf("%d %d %d\n",at, bt, ct);
    if(at==bt && bt>ct || ct==bt)
    {
        if(a3>b3)
    }
    if(at>bt && at>ct)
    {
        printf("1 %d", at);
    }
    else if(bt>at && bt>ct)
    {
        printf("2 %d", bt);
    }
    else if(ct>bt && ct>at)
    {
        printf("3 %d", ct);
    }
    else{
        if(at>bt)
            printf("0 %d", at);
        else
            printf("0 %d", bt);
    }
    return 0;
}

Embed on website

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