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<algorithm>
#include<functional>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<string>
#include<sstream>
#include<iostream>
#include<iomanip>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<bitset>
#include<climits>

#define all(c) (c).begin(), (c).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define pb(e) push_back(e)
#define mp(a, b) make_pair(a, b)
#define fr first
#define sc second

typedef unsigned long long UInt64;
typedef long long Int64;

const int INF=100000000;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

using namespace std;

typedef pair<int ,int > P;

void solve(int n)
{
	vector<P> vec;
	rep(i,n)
	{
		int p,d1,d2;
		cin>>p>>d1>>d2;
		vec.pb(P(d1+d2,p));
	}

	sort(all(vec),greater<P>());

	vector<P>::iterator it = vec.begin();

	cout<<it->sc<<" "<<it->fr<<endl;

}

int main()
{
	int n;
	while(cin>>n)
	{
		if(n==0) return 0;

		solve(n);
	}
		return 0;
}

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

int main(){
    int n;
    while(cin>>n,n){
        int ma=0,id;
        while(n--){
            int p,a,b;
            cin>>p>>a>>b;
            if(a+b>ma){
                ma=a+b;
                id=p;
            }
        }
        cout<<id<<" "<<ma<<endl;
    }
    return 0;
}

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

int main(){
	int n,p,d1,d2,mp,md = -1;
	while(cin >> n,n){
		for(int i = 0;i < n;i++){
		cin >> p >> d1 >> d2;
		if(d1 + d2 > md){
			mp = p;
			md = d1 + d2;
		}
		}
		cout << mp << " " << md << endl;
	}
	return 0;
}

C++: /*
	Walking in the Hospital
*/
#include	<iostream>
#include	<vector>
#include	<algorithm>
#include	<utility>

using namespace std;

typedef pair<int, int> P_II;

int main(void) {
	while(1) {
		int n;
		vector<P_II> LIST;
		
		cin >> n;
		if(n == 0) { break; }
		for(int i = 0; i < n; i++) {
			int buf_d1, buf_d2, buf_hosnum;
			
			cin >> buf_hosnum >> buf_d1 >> buf_d2;
			LIST.push_back( P_II( buf_d1+buf_d2, buf_hosnum ) );
		}
		sort( LIST.begin(), LIST.end() );
		
		cout << LIST.rbegin()->second << ' ' << LIST.rbegin()->first << endl;
	}
	return 0;
}

C++: #include <cstdio>
#include <queue>
#include <algorithm>
using namespace std;

int main()
{
    auto cmp = [](const pair<int, int> &a, const pair<int, int> &b) {
        return a.second < b.second;
    };
    int n, p, d1, d2;
    for (; ;) {
        scanf("%d", &n);
        if (n == 0) break;
        priority_queue<pair<int, int>, vector<pair<int, int> >, decltype (cmp) > pq(cmp);
        for (int i = 0; i < n; i++) {
            scanf("%d %d %d", &p, &d1, &d2);
            pq.push({p, d1+d2});
        }
        printf("%d %d\n", pq.top().first, pq.top().second);
    }

}

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

int main(){
    int n;
    int max_d;
    int max_p;

    while(cin >> n, n != 0){
        int p;
        int d1, d2;
        max_d = 0;

        for(int i=1; i<=n; i++){
            cin >> p >> d1 >> d2;
            if(d1 + d2 > max_d){
                max_d = d1 + d2;
                max_p = p;
            }
        }
        printf("%d %d\n", max_p, max_d);
    }
    return 0;
}

C++: #include <iostream>
#include <sstream>
//#include <fstream>

using namespace std;

int main()
{
//	cut here before submit 
//	freopen ("testcase.walkinghospital", "r", stdin );
	string str = "";
	int n;

	while (getline (cin, str ) ) {
		stringstream ssn (str );
		ssn >> n;

		if (n == 0 ){
			break;
		} // end if

		int maxd = 0;
		int maxp = -1;
		for (int i = 0; i < n; ++i){
			int p, d1, d2;
			getline (cin, str );
			stringstream ss (str );
			ss >> p >> d1 >> d2;
			if (maxd < d1 + d2 ){
				maxd = d1 + d2;
				maxp = p;
			} // end if
		} // end for
		cout << maxp << " " << maxd << endl;
	} // end loop
		
	return 0;
}

C++: #include<stdio.h>
int main(void)
{
    int a[10000],b[10000],ban[10000],i,n,ran,w;
	while(1){
	    scanf("%d",&n);
		if(n==0) break;
		ran=0;
		for(i=0;i<n;i++){
		    scanf("%d %d %d",&ban[i],&a[i],&b[i]);
		}
		for(i=0;i<n;i++){
		    if(ran<a[i]+b[i]){
			    ran=a[i]+b[i];
				w=i;
			}
		}
		printf("%d %d\n",ban[w],ran);
	}
	return 0;
}

C++: #include <iostream>
using namespace std;
struct k{
  int bangou;
  int score;
};
int main(){
  int n;
  int d1,d2,b;
  k id[10001];
  while(  cin >> n,n ){
    for(int i = 0 ; i < n ; i++){
      cin >> b >> d1 >> d2;
      id[i].bangou = b;
      id[i].score = (d1 + d2);
    }
    int max = 0;
    int ans_b; 
    for(int i = 0 ; i < n ; i++){
      if(id[i].score > max){
	max = id[i].score;
	ans_b = id[i].bangou;
      }
    }
    cout << ans_b << " " << max << endl;
  }
  return 0;
}

C++: #include<iostream>
#include<algorithm>
#include<functional>
using namespace std;
int main(){
	int n;
	while(cin>>n,n){
		int ans=0,most=-1,tmp,t1,t2;
		for(int i=0;i<n;i++){
			cin>>tmp>>t1>>t2;
			if(most<t1+t2){
				most=t1+t2;
				ans=tmp;
			}
		}
		cout<<ans<<" "<<most<<endl;
	}
	return INT_MIN;
}

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

int main(void)
{
    int n;
    int p, d1, d2;
    int max_p = 0, max = 0;
    
    while (1) {
        max_p = max = 0;
        scanf("%d", &n);
        if (n == 0) break;
        
        for (int i = 0; i < n; i++){
            scanf("%d %d %d", &p, &d1, &d2);
            if (max < (d1 + d2)){
                max = d1 + d2;
                max_p = p;
            }
        }
        
        printf("%d %d\n", max_p, max);
    }
    
    return (0);
}

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

using namespace std;

int main(void){
	int n;
	while(cin >> n && n){
		vector<pair<int,int> > p;
		int d1,d2, num;
		for(int i=0;i<n;i++){
			cin >> num >> d1 >> d2;
			p.push_back(make_pair(d1+d2,num));
		}
		sort(p.begin(), p.end());
		cout << p.back().second << " " << p.back().first << endl;
 	}
}

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

int main(){
    while(1){
        int n;
        cin >> n;
        if(n==0) break;
        vector<pair<int, int> > walk(n);
        for(int i=0; i<n; i++){
            int p,a,b;
            cin >> p >> a >> b;
            walk[i] = make_pair(a+b, p);
        }
        pair<int, int> ans = *max_element(walk.begin(), walk.end());
        cout << ans.second << " " << ans.first << endl;
    }
    return 0;
}

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

struct Patient
{
  int number;
  int length;

  bool operator<( const Patient& right ) const
  {
    return length < right.length;
  }
};

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

    vector<Patient> patients;
    for (int i = 0; i < n; ++i)
    {
      int buf_num, buf_l1, buf_l2;
      cin >> buf_num >> buf_l1 >> buf_l2;
      Patient buf_patient = {buf_num, buf_l1 + buf_l2};
      patients.push_back(buf_patient);
    }

    sort(patients.begin(), patients.end() );
    cout << patients.back().number << " " << patients.back().length << endl;

  }
  return 0;
}