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<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<iostream>
using namespace std;
int n, a, b, c, maxn, num;
int main() {
	while (true) {
		cin >> n; maxn = 0; num = 0;
		if (n == 0) { break; }
		for (int i = 0; i < n; i++) {
			cin >> a >> b >> c;
			if (maxn < b + c) {
				maxn = b + c;
				num = a;
			}
		}
		cout << num << ' ' << maxn << endl;
	}
}

C++: #define _USE_MATH_DEFINES
#include <iostream>
#include <complex>
#include <algorithm>
#include <vector>
#include <stack>
#include <string>
#include <queue>
#include <cmath>
#include <math.h>
#include <numeric>
#include <list>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <climits>
#include <set>
#include <memory.h>
#include <memory>
#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cassert>
#include <map>
#include <cassert>
#include <time.h>
#include <ctime>

using namespace std;

typedef complex<double> xy_t;
typedef pair<xy_t, xy_t> line;
typedef vector<xy_t> polygon;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<int , P> PP;
typedef pair<int, string> Ps;
typedef vector<int> vec;
typedef vector<vec> mat;
const int INF = 1 << 29;
const double EPS = 1e-10;
const double PI = 3.1415926535897932384626433832795;
const int CLK = CLOCKS_PER_SEC;

#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, m, n) for(int i = m; i < n; i++)
#define repD(i, n) for(int i = n; i >= 0; i--)

P ps[10000];

int main(){
	int n;
	int id, d1, d2;
	while(cin >> n && n){
		rep(i, n){
			cin >> id >> d1 >> d2;
			ps[i] = P(d1 + d2, id);
		}
		sort(ps, ps + n);
		cout << ps[n-1].second << " " << ps[n-1].first << endl;
	}
	return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
int main()
{
	while(true){
		int N;
		int dist[10009];
		for(int i=0;i<10009;i++){
			dist[i]=-1;
		}
		scanf("%d",&N);
		if(N==0)break;
		for(int i=0;i<N;i++){
			int P,D1,D2;
			scanf("%d%d%d",&P,&D1,&D2);P--;
			dist[P]=D1+D2;
		}
		int ma=-1,mai;
		for(int i=0;i<10009;i++){
			if(ma<dist[i]){
				ma=dist[i];
				mai=i;
			}
		}
		printf("%d %d\n",mai+1,ma);
	}
	return 0;
}

C++: //25
#include<iostream>

using namespace std;

int main(){
  for(int n;cin>>n,n;){
    int m=0,mid;
    while(n--){
      int id,d,dd;
      cin>>id>>d>>dd;
      if(m<d+dd){
	m=d+dd;
	mid=id;
      }
    }
    cout<<mid<<' '<<m<<endl;
  }
  return 0;
}

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

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(n) rep(i,n)
#define all(n) n.begin(),n.end()

typedef pair<int, int> pp;

int main()
{
    int n, p, d1, d2;
    while(cin >> n && n)
    {
        vector<pp> ps;
        REP(n){cin >> p >>  d1 >> d2; ps.push_back(pp(d1+d2, p));}

        sort(all(ps), greater<pp>() );

        cout << ps[0].second << " " << ps[0].first << 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 86687676;
}

C++: #include <iostream>
using namespace std;
int main(){
	int n;
	while(cin>>n,n){
		int p,d1,d2,maxp,maxd;
		maxp=0;
		maxd=0;
		for(int i=0; i<n; i++){
		cin>>p>>d1>>d2;
	if(maxd<d1+d2){
		maxd=d1+d2;
		maxp=p;
			}
		}	
		cout<<maxp<<" "<<maxd<<endl;
	}	
}

C++: #include<iostream>
using namespace std;
int main(){
	int n,max=0,num=0;
	cin>>n;
	for(int p,d1,d2;n>=1;n--){
		cin>>p>>d1>>d2;
		if((d1+d2)>max){
			num=p;
			max=d1+d2;
		}
	}
	cout<<num<<" "<<max<<endl;
}

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

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

    vector<pair<int, int> > pa(n);
    for (int i = 0; i < n; ++i) {
      int p, d1, d2;
      cin >> p >> d1 >> d2;
      pa[i].first = d1 + d2;
      pa[i].second = p;
    }
    sort(pa.begin(), pa.end(), greater<pair<int, int> >());
    cout << pa[0].second << " " << pa[0].first << endl;
  }
  return 0;
}

C++: #include <iostream>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
int main(){
	int n;
	while(cin >> n , n){
		pair<int,int> ans;
		rep(i,n){
			int a,b,c;
			cin >> a >> b >> c;
			ans = max( ans , make_pair(b+c,a));
		}
		cout << ans.second << " " << ans.first << endl;
	}
}

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

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

int main(){
	int n, ans;
	while( cin >> n , n ){
		map<int,int> a;
		for(int i=0 ; i<n ; ++i ){
			int p,d1,d2;
			cin >> p >> d1 >> d2;
			a[p] = d1 + d2;
		}
		typedef map<int,int>::iterator Iter;
		int foo = 0;
		for(Iter it = a.begin() ;it!=a.end();++it){
			if( foo <= it->second ){
				foo = it->second;
				ans = it->first;
			}
		}
		cout << ans << " " << a[ans] << endl;
	}
}

C++: #include <iostream>
using namespace std;
int main(void){
    int n, p[10100];
    int d1[10100], d2[10100];
 
    while(true){
        cin >> n;
        if(n == 0) {
            break;
        }
 
        for(int i = 0; i < n; i++){
            cin >> p[i] >> d1[i] >> d2[i];
        }
 
        int d_sum[10100];
        int d_max = 0, p_max;
         
        for(int i = 0; i < n; i++){
            d_sum[i] = d1[i] + d2[i];
            if(d_sum[i] > d_max){
                d_max = d_sum[i];
                p_max = p[i];
            }
        }
        cout << p_max << " " << d_max << endl;
    }
}

C++: #include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
#define rep2(x,from,to) for(int x=(from);(x)<(to);(x)++)
#define rep(x,to) rep2(x,0,to)
using namespace std;
int main(){
	int n, d1, d2;
	while(cin >> n, n) {
		vector<pair<int, int> > v;
		rep(i,n) {
			pair<int, int> p;
			cin >> p.second >> d1 >> d2;
			p.first = d1 + d2;
			v.push_back(p);
		}
		sort(v.begin(), v.end());
		cout << v[v.size()-1].second << " " << v[v.size()-1].first << endl;
	}
}