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>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
using namespace std;

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

C++: #include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<cassert>
#include<iostream>
#include<sstream>
#include<string>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<utility>
#include<numeric>
#include<algorithm>
#include<bitset>
#include<complex>
#include<stack>

using namespace std;

typedef long long Int;
typedef vector<int> vint;
typedef pair<int,int> pint;
typedef vector<string> vstring;
typedef vector<pint> vpint;
typedef stringstream SS;

template<class T> void chmin(T &t, T f) { if (t > f) t = f; }
template<class T> void chmax(T &t, T f) { if (t < f) t = f; }

#define rep(i,n) for(int i=0;i<(n);++i)
#define repn(i,m,n) for(int i=(m);i<(n);++i)
#define repd(i,n) for(int i=(n)-1;i>=0;--i)
#define repnd(i,m,n) for(int i=(n)-1;i>=(m);--i)
#define rep0(i,n) for(i=0;i<(n);++i)
#define repn0(i,m,n) for(i=(m);i<(n);++i)
#define repd0(i,n) for(i=(n)-1;i>=0;--i)
#define repnd0(i,m,n) for(i=(n)-1;i>=(m);--i)
#define repc(i,n) for(int i=0;i<=(n);++i)
#define repcn(i,m,n) for(int i=(m);i<=(n);++i)
#define repcd(i,n) for(int i=(n);i>=0;--i)
#define repcnd(i,m,n) for(int i=(n);i>=(m);--i)
#define repc0(i,n) for(i=0;i<=(n);++i)
#define repcn0(i,m,n) for(i=(m);i<=(n);++i)
#define repcd0(i,n) for(i=(n);i>=0;--i)
#define repcnd0(i,m,n) for(i=(n);i>=(m);--i)
#define all(n) n.begin(),n.end()
#define sz(n) ((int)(n).size())
#define IL for(;;)
#define MP make_pair
#define PB push_back
#define X second
#define Y first
#define p_queue(n) priority_queue<n,vector<n>,greater<n> >
#define PUTLINE cout<<"LINE:"<<__LINE__<<endl;

const int INF = 2147483647/3;
const double EPS = 1e-10;
const double PI = acos(-1.0);

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



int main() {
	int n;
	IL{
		cin>>n;
		if(n==0)break;
		int p,d1,d2;
		int r,dis=0;
		rep(i,n){
			cin>>p>>d1>>d2;
			if(d1+d2>dis){
				r=p;
				dis=d1+d2;
			}
		}
		cout<<r<<" "<<dis<<endl;
	}
	return 0;
}

C++: #include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<vector>
#include<cmath>
#include<cstdio>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define it iterator
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double ESP=1e-10;
using namespace std;
int main(){
  int n;
  while(cin>>n,n){
    map<int,int>m;
    rep(i,n){    
      int a,b,c;
      cin>>a>>b>>c;
      m[b+c]=a;
    }
    map<int,int>::it it=m.end();it--;
    cout<<it->second<<" "<<it->first<<endl;
  }

}

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

int main(){
  int n,pm[10005],pe[10005],pj[10005];

  while(1){
    scanf("%d",&n);
    if(n==0) break;
    
    for(int i=0;i<n;i++){
      scanf("%d %d %d",&pm[i],&pe[i],&pj[i]);
      if(pm[i]==100||pe[i]==100||pj[i]==100){
	printf("A\n");
      }else if(pm[i]+pe[i]>=180){
	printf("A\n");
      }else if(pm[i]+pe[i]+pj[i]>=240){
	printf("A\n");
      }else if(pm[i]+pe[i]+pj[i]>=210){
	printf("B\n");
      }else if(pm[i]+pe[i]+pj[i]>=150&&(pm[i]>=80||pe[i]>=80)){
	printf("B\n");
      }else printf("C\n");
    }
  }

  return 0;
}

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

using namespace std;

int main(void){
	while(1){
		map<int, int> data;
		int a,n;
		cin >> n;
		if(n==0)break;
		for(a=0;a<n;a++){
			int b,c,d;
			cin >> b >> c >> d;
			data.insert(pair<int, int>(c+d,b));
		}
		map<int, int>::iterator it = data.end();
		it--;
		cout << (*it).second << " " << (*it).first << endl;
	}
	return 0;
}

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

int main(void){
	int n, N, d;

	while (1){
		n = 0;
		N = 0;
		d = 0;
		cin >> n;
		if (n == 0)
			break;
		vector<int> p(n), d1(n), d2(n), dsum(n);

		for (int i = 0; i < n; i++){
			cin >> p.at(i) >> d1.at(i) >> d2.at(i);
			dsum.at(i) = d1.at(i) + d2.at(i);
		}

		d = dsum.at(0);
		for (int i = 1; i < n; i++){
			if (d < dsum.at(i)){
				N = i;
			}
		}

		cout << p.at(N) << " " << dsum.at(N) << endl;
	}
	return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
	while(1){
		int n = 0;
		cin >> n;
		if(n == 0) break;
		int maxNum = -1, maxP;
		for(int i = 0;i < n;i++){
			int p, d1, d2;
			cin >> p >> d1 >> d2;
			if(maxNum < d1 + d2){
				maxNum = d1 + d2;
				maxP = p;
			}
		}
		cout << maxP << ' ' << maxNum << endl;
	}
	return 0;
}

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

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

int main()
{
	while (true){
		int n, dist = 0, who = 0;
		cin >> n;
		if (!n) break;
		for (int i = 0; i < n; i++){
			int p, d1, d2;
			cin >> p >> d1 >> d2;
			if (dist < d1 + d2) dist = d1 + d2, who = p;
		}
		cout << who << " " << dist << endl;
	}
	return 0;
}

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

using namespace std;

int main(void){

  int n;
  while( cin >> n , n ){

    int ans,M = 0;
    int a,b,c;
    for( int i = 0 ; i < n ; i++ ){
      cin >> a >> b >> c;
      if( b + c > M ){
	ans = a;
	M = b + c;
      }
    }

    cout << ans << " " << M << endl;

  }
  return 0;
}

C++: #include<stdio.h>
#include <iostream>
using namespace std;
int main(void){

	int n,i,j,d1,d2,p,a,d=-1,c=-1,max=-1;
	scanf("%d",&n);
	while ( n > 0){
		
		for (i = 0; i < n; i++){
			scanf("%d %d %d", &p, &d1, &d2);
			a = d1 + d2;
			if (a > max){
				c = p;
				d = a;
				max = a;
			}
		}
		max = -1;

			printf("%d %d\n", c , d);
			scanf("%d", &n);
	}
}

C++: #include <iostream>

using namespace std;

int main(int argc, char* argv[])
{
	int n;
	
	while( cin >> n ) {

		if( n == 0 ) break;

		int p, d1, d2;
		int maxd = 0;
		int maxp = 0;
		
		for( int i = 0; i < n; i++ ) {
			cin >> p >> d1 >> d2;
			int d = d1+d2;
			if( maxd <= d ) {
				maxd = d;
				maxp = p;
			}
		}

		cout << maxp << " " << maxd << endl;
	}

    return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> P;

int main() {
    while (true) {
        int n;
        cin >> n;
        
        if (n==0) {
            break;
        }
        
        vector<P> l;
        
        for (int i=0; i<n; i++) {
            int pi, d1i, d2i;
            cin >> pi >> d1i >> d2i;
            l.push_back(P(d1i+d2i, pi));
        }
        
        sort(l.begin(), l.end());
        
        cout << l[n-1].second << " " << l[n-1].first << endl;
    }
}