Go: package main

import (
	"bufio"
			"os"
	"strconv"
	"strings"
	"sort"
	"fmt"
)

var scanner = bufio.NewScanner(os.Stdin)

type Patient struct {
	ID, Distance int
}
type ByDistance []Patient
func (p ByDistance) Len() int { return len(p) }
func (p ByDistance) Swap(i, j int) { p[i], p[j] = p[j], p[i] }
func (p ByDistance) Less(i, j int) bool { return p[i]. Distance > p[j].Distance }

func main() {
	for scanner.Scan() {
		n, _ := strconv.Atoi(scanner.Text())
		if n == 0 {
			break
		}
		patients := make([]Patient, n)
		for i := 0; i < n; i++ {
			scanner.Scan()
			buf := strings.Split(scanner.Text(), " ")
			id, _ := strconv.Atoi(buf[0])
			am, _ := strconv.Atoi(buf[1])
			pm, _ := strconv.Atoi(buf[2])
			patients[i] = Patient{id, am+pm}
		}
		sort.Sort(ByDistance(patients))
		fmt.Println(patients[0].ID, patients[0].Distance)
	}
}

C++: #include <bits/stdc++.h>
using namespace std;

int main()
{
    int N;
    cin>>N;
    while(N!=0){
        int index=0;
        int maxDist=0;
        for ( int i = 0; i < N; i++ ) {
            int k,a,b;
            cin>>k>>a>>b;
            if(a+b>maxDist) {
                maxDist = a + b;
                index = k;
            }
        }
        cout << index << " " << maxDist << endl;
        cin >> N;
    }
    return ( 0 );
}

C++: #include <bits/stdc++.h>
using namespace std;

int main() {
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  int n, p, d1, d2;
  while (cin >> n, n) {
    int md = -1, mp;
    while (n--) {
      cin >> p >> d1 >> d2;
      if (d1 + d2 > md) {
        md = d1 + d2;
        mp = p;
      }
    }
    cout << mp << " " << md << "\n";
  }
}

C++: #include <iostream>
using namespace std;

int main() {
	// your code goes here
	int N;
	
	while(cin >> N && N){
	int p=0,d1=0,d2=0,mp=0,md1=0,md2=0;
	for(int i=0;i<N;i++){
		cin >> p >> d1 >> d2;
		if(d1+d2>md1+md2){
			mp=p;
			md1=d1;
			md2=d2;
		}
	}
		
		cout << mp << " " << md1+md2 << endl;
	}
	return 0;
}

C++: #include<iostream>
#include<algorithm>
using namespace std;
int main(){
	int d1, d2,number, maxu = 0,maxn = 0,  kai;
	cin >> kai;
	while (kai != 0){
		for (int i = 0; i < kai; i++){
			cin >> number >> d1 >> d2;
			if (maxu < d1 + d2){
				maxu = d1 + d2;
				maxn = number;
			}
		}
		cout << maxn << " " << maxu << endl;
		maxu = maxn = 0;
		cin >> kai;
	}
	return 0;
}

C++: #include<bits/stdc++.h>

#define endl '\n'

using namespace std;

typedef pair<int,int>P;

P p[100001];

int main(){

  cin.tie(0);     // cout と cin の同期を切る
  ios::sync_with_stdio(false);  /* cの stdioストリーム (printfとか)と*/

  int n;

  int a,b,c;

  while(1){
    cin>>n;

    if(n==0){
      break;
    }

    for(int i=0;i<n;i++){
      cin>>a>>b>>c;

      p[i]=make_pair(b+c,a);

    }


    sort(p,p+n);

    cout<<p[n-1].second<<" "<<p[n-1].first<<endl;

  }


  return 0;

}

C++: #include<stdio.h>
int main(void)
{
	int n,i;
	int p,d1,d2;
	int max,p1;
	scanf("%d",&n);
	max=0;
	while(n!=0){
		for(i=0;i<n;i++){
			scanf("%d %d %d",&p,&d1,&d2);
			if(max<d1+d2){
				p1=p;
				max=d1+d2;
			}
		}
	printf("%d %d\n",p1,max);
	scanf("%d",&n);
	}
}

C++: #include<iostream>

using namespace std;

int main () {

	while(true){
		int n;
		cin>>n;
		if(n==0)break;

		int max_p=0,max_d=0;
		for(int i=0;i<n;i++){
			int p,d1,d2;
			cin>>p>>d1>>d2;

			if(max_d<=d1+d2){
				max_d=d1+d2;
				max_p=p;
		}
	}
		cout<<max_p<<" "<<max_d<<endl;
	}
	
	return 0;
}

C++: #include <bits/stdc++.h>
#define r(i,a,n) for(int i=a;i<n;i++)
#define R(i,a,n) for(int i=a;i>=n;i--)
using namespace std;
int main(){
	int n,a,b,c,s,w;
	while(cin>>n,n){
		s=0;
		while(n--){
			cin>>a>>b>>c;
			if(s<b+c){
				w=a;
				s=b+c;
			}
		}
		cout<<w<<' '<<s<<endl;
	}
}

C++: #include <iostream>
using namespace std;

int main(){
    while(1){
	int n;
	int max = 0, num = 0;
	cin >> n;
	if (n == 0) break;
	for (int i = 0; i < n; i++){
	    int p, d1, d2, d;
	    cin >> p >> d1 >> d2;
	    d = d1 + d2;
	    if (d > max){
		max = d;
		num = p;
	    }
	}
	cout << num << " " << max << endl;
    }
}

C++: #include<iostream>
using namespace std;
int main() {
	int n;
	while (cin >> n&&n) {
		int p[10000], d1[10000], d2[10000];
		int top[2] = {};
		for (int i = 0; i < n; i++) {
			cin >> p[i] >> d1[i] >> d2[i];
			if (top[1] < d1[i] + d2[i]) {
				top[0] = p[i];
				top[1] = d1[i] + d2[i];
			}
		}
		cout << top[0] << top[1] << endl;
	}
	return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
  while(1){
    int data[10001][4]={0};
    int n,p;
    int max=0,maxn;
    cin >> n;
    if(n==0)break;
    for(int i=0;i<n;i++){
      cin >> p;
      data[i][0]=p;
      cin >> data[i][1] >> data[i][2];
      data[i][3]=data[i][1]+data[i][2];
    }
    for(int i=0;i<n;i++){
      if(max<data[i][3]){
	max=data[i][3];
	maxn=i;
      }
    }
    cout << data[maxn][0] << " " << max << endl;
  }
}

C++: #include<iostream>

int *p,*d,m,n,o;

int max(){
	int tmp=d[0],ans=0;
	for(int i=1; i<m; i++){
		if(d[i]>tmp){
			tmp = d[i];
			ans = i;
		}
	}
	return ans;
}

int main(){
	while(true){
		std::cin >> m;
		if(!m)
			return 0;
		p = new int[m];
		d = new int[m];
		for(int i=0; i<m; i++){
			std::cin >> p[i] >> n >> o;
			d[i] = n+o;
		}
		n = max();
		std::cout << p[n] << ' ' << d[n] << std::endl;
		delete[] p;
		delete[] d;
	}
}

C++: #include<iostream>
#include<vector>
using namespace std;
struct MyStruct{
	int n;
	int w;
};
int main() {
	vector<MyStruct>l;
	MyStruct t;
	int num, walk1, walk2, n, mnum, mwalk;
	while (cin >> n){
		if (n == 0)break;
		cin >> num >> walk1 >> walk2;
		walk1 += walk2;
		mnum = num;
		mwalk = walk1;
		for (int i = 0; i < n - 1; i++) {
			cin >> num >> walk1 >> walk2;
			walk1 += walk2;
			if (walk1 >= mwalk){
				mnum = num;
				mwalk = walk1;
			}
		}
		t.n = mnum;
		t.w = mwalk;
		l.push_back(t);
	}
	for (MyStruct i : l) {
		cout << i.n << ' ' << i.w << endl;
	}
	char qq;
	cin >> qq;
}

C++: #include<algorithm>
#include<iostream>

int main()
{
	int n;
	while( std::cin >> n, n )
	{
		int id, d = 0;

		for( int i = 0; i != n; ++i )
		{
			int p, d1, d2;
			std::cin >> p >> d1 >> d2;
		
			if( d1 + d2 > d )
			{
				d = d1 + d2;
				id = p;
			}
		}

		std::cout << id << ' ' << d << std::endl;
	}

	return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
int main(){
  int n,p,d1,d2,number,maxs;
  while(1){
    maxs=0;
    cin>>n;
    if(n==0) break;
    for(int i=0;i<n;i++){
      cin>>p>>d1>>d2;
      if(maxs<d1+d2){
	number=p;
	maxs=d1+d2;
      }
    }
    cout<<number<<' '<<maxs<<endl;
  }
  return(0);
}

C++: #include<iostream>
using namespace std;
int main(){
  int n,bell,most2,number,length1,length2,totallength[10000],most1=-1;
  while(1){
    most1=-1;
    most2=0;
    cin >> n;
    if(n==0){
      break;
    }
    for(int i=0;i<n;i++){
      cin >> number >> length1 >> length2;
      totallength[number]=length1+length2;
      if(most1<totallength[number]){
	most1=totallength[number];
	most2=number;
      }
    }
    cout << most2 << " " << most1 << endl;
  }
  return (0);
}

C++: #include<iostream>
using namespace std;
int main(){
	int n,p,d1,d2,maxp,maxv;
	while(1){
		cin >> n
		if(n == 0) break;
		maxp = maxv = 0;
		while(n --){
			cin >> p >> d1 >> d2;
			if(maxv < d1+d2){
				maxp = p;
				maxv = d1+d2;
		}
		cout<< maxp << maxv;
	}
}

C++: #include <iostream>
using namespace std;

int main()
{
        int n,p,d1,d2,sum=0,num;
        while(true){
        cin >> n;
        if(n == 0){
                break;
        }
        for(int i=0;i<n;i++){
                cin >> p >> d1 >> d2;
                if(sum < (d1+d2)){
                        sum = d1 + d2;
                        num = p;
                }
        }
        cout << num << ' ' << sum << endl;
        }

        return 0;
}