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++: // #define _CRT_SECURE_NO_WARNINGS
// #define _USE_MATH_DEFINES
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <locale>
#include <cctype>
#include <sstream>
#include <iomanip>	// 10????????? cout << setprecision(10) << double;
using namespace std;

typedef long long LL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef map<int, int> MAPII;
typedef multimap<int, char, greater<int> > MuMAPIC;
typedef vector<pair<int, int> > VPII;
typedef multimap<int, string, greater<int> > MuMIS;

#define MP make_pair
#define FAST_IO  cin.tie(0); ios::sync_with_stdio(false);
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
//for gcc (???test)
// #define FOREACH_IT(it,c) for(typeof(c)::iterator it=(c).begin(); it!=(c).end(); ++it)
//for Visual Studio
#define foreach_it(type,it,c) for(type::iterator it=c.begin(),c_end=c.end();it!=c_end;++it)
// for Debug.
#define DUMP_VVI(b) FOR(i,0,b.size()){FOR(j,0,b[i].size())printf("%d ",b[i][j]);puts("");}
#define D_OUT(str,value) if(dbgF){cout<<str<<" : "<<value<<endl;}
// ??\??????push_back(d)???array[d]???????????????1?????§?????????
// int INPUT_INT() {int d;cin>>d;return d;}
template<class T>T IN(){T d;cin>>d;return d;}
// ?????§??¬?´???°???Greatest Common Divisor???
LL gcd(LL a, LL b){ return (b > 0) ? gcd(b, a%b) : a; }
// ????°???¬?????°???Least Common Multiple???
LL lcm(LL a, LL b){ return a / gcd(a, b) * b; }

// ------------------- include, typedef, define END. -------------------

void Output(VI personNo){
	int maxValue = -1;
	int ansNo = 0;
	FOR(i,0,10001){
		if(maxValue < personNo[i]){
			maxValue = personNo[i];
			ansNo = i;
		}
	}
	cout << ansNo << " " << maxValue << endl;
}

int main(){
	FAST_IO;
	// for D_OUT(str, value)  ... cout<< str <<" : "<< value <<endl;
	bool dbgF = true;
	
	//??????????????????????????????.
	int n=0;
	int p,d1,d2;
	while(cin>>n, n){
		VI personNo(10001,0);
		FOR(i,0,n){
			cin >> p>> d1>> d2;
			personNo[p] = d1 + d2;
		}
		Output(personNo);
	}
	
	return 0;
}

C++: #include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <cstring>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <fstream>
#include <complex>
#include <stack>
#include <queue>

using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
static const double EPS = 1e-5;

#define FOR(i,k,n) for (int i=(k); i<(int)(n); ++i)
#define REP(i,n) FOR(i,0,n)

int main(void){
  int n;
  while(cin>>n){
    if(n==0) break;
    int max_l=-1;
    int p_max = 0;
    REP(i,n){
      int p,d1,d2;
      cin>>p>>d1>>d2;
      if(d1+d2>max_l){
        max_l = d1+d2;
        p_max = p;
      }
    }
    printf("%d %d\n",p_max,max_l);
  }

  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<<endl;
	}
}

C++: //
//  main.cpp
//  AOJ_0217
//
//  Created by ツ閉淞暗、 ツ重ツ和 on 12/10/11.
//  Copyright 2011 ツ嘉ッツ津δ妥・ツ学. All rights reserved.
//

#include <cstdlib>
#include <iostream>
#include <sstream>

int main ()
{
    using namespace std;
    int n;
    string line;
    istringstream iss;
    
    while ( getline( cin, line ) ) {
        iss.str( line );
        // the number of patients, or 0 for temination.
        if ( iss >> n ) {
            // terminate
            if ( n == 0 ) return EXIT_SUCCESS;
            else if (n < 1 || n > 10000) return EXIT_FAILURE;
            
            // patient id
            int p;
            // patient id of max d1+d2
            int max_p;
            // 1st and 2nd walking distances
            int d1, d2;
            // max sum of walking distance
            int max = -1;
            // how many data processed
            int count = 0;
            
            iss.clear();
            // let's get data of patients
            while ( getline( cin, line ) ) {
                iss.str( line );
                if ( iss >> p >> d1 >> d2 ) {
                    // logic error: inapropriate data range
                    if (p < 1 || p > 10000 || d1 < 0 || d1 > 5000 || d2 < 0 || d1 > 5000 )
                        return EXIT_FAILURE;
                    iss.clear();
                    // FIXME: duplication (e.g. no p duplicate, no d1+d2 duplicate) check is not implemented
                    if ( max < d1 + d2) {
                        max = d1 + d2;
                        max_p = p;
                    }
                    // data of patients were all processed
                    if ( ++count == n ) {
                        cout << max_p << " " << max << endl;
                        max = -1;
                        break;
                    }
                }
                // logic error: there should be 3 inputs
                else return EXIT_FAILURE;
            }
        }
        // logic error: there should be input
        else return EXIT_FAILURE;
    }
    
    // logic error: shouldn't be here
    return EXIT_FAILURE;
}

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

int main()
{
  int n;

  while (cin >> n, n){
    int p, pn, m = 0, a, b;

    for (int i = 0; i < n; i++){
      cin >> pn >> a >> b;
      if (a + b > m){
        m = a + b;
        p = pn;
      }
    }
    cout << p << ' ' << m << endl;
  }
}

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

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

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

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

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

C++: #include <iostream>
#include <algorithm>
using namespace std;
#define REP(i,b,n) for(int i=b;i<n;i++)
#define rep(i,n) REP(i,0,n)
int n;
void solve() {
  int mp = -1, md = 0;
  rep(i,n) {
    int p, d1, d2; cin>>p>>d1>>d2;
    if (d1+d2 > md) {
      md = d1 + d2; mp = p;
    }
  }
  cout<<mp<<" "<<md<<endl;
}

int main (int argc, char const* argv[]) {
  while (cin>>n, n) {
    solve();
  }
  return 0;
}