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----------------------------------------------------------------------------------------------------------------------
#include <bits/stdc++.h>

//using namespace--------------------------------------------------------------------------------------------------------------
using namespace std;

//define-----------------------------------------------------------------------------------------------------------------------
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define FOR(i, s, n) for(int i = s; i < (int)n; i++)
#define per(i, n) for(int i = n; i >= 0; i--)
#define ROF(i, s, n) for(int i = s; i >= (int)n; i--)
#define FORIT(i, A) for (auto i : A)
#define PRINT(x) cout << (x) << "\n"
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define EACH(i, n) for (__typeof((n).begin()) i = (n).begin(); i != (n).end(); ++i)
#define SZ(a) int((a).size())
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define INF 1 << 25
#define CLR(a) memset((a), 0 ,sizeof(a))
#define dump(x) cerr << #x << " = " << (x) << "\n";
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << "\n";
#define sq(n) (n) * (n)

//typedef----------------------------------------------------------------------------------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef unsigned int uint;
typedef unsigned long long ull;

//const------------------------------------------------------------------------------------------------------------------------
const double EPS = 1e-10;
const double PI = acos( -1.0 );

//global-----------------------------------------------------------------------------------------------------------------------
int n;
int ar[ 10000 ];

//function---------------------------------------------------------------------------------------------------------------------
int main() {
	while ( scanf( "%d", &n ) ) {
		if ( n == 0 ) {
			return 0;
		}
		rep( i, 10000 ) {
			ar[ i ] = 0;
		}
		int mx = 0;
		rep( i, n ) {
			int numbar, one, two;
			scanf( "%d %d %d", &numbar, &one, &two );
			ar[ numbar - 1 ] = one + two;
			if ( ar[ mx ] < ar[ numbar - 1 ] ) {
				mx = numbar - 1;
			}
		}
		printf( "%d %d\n", mx + 1, ar[ mx ] );
	}
	return 0;
}

C++: using namespace std;
#include <iostream>
#include <string>
#include <set>
#include <functional>
#include <vector>
#include <algorithm>
#include <stdio.h>
typedef pair<int,int> pa;
int main()
{
	int n;
	while(cin>>n&&n){
		pa p[10000]={};//d,p
		for(int i=0;i<n;i++){
			int d1,d2;cin>>p[i].second>>d1>>d2;
			p[i].first=d1+d2;
		}
		sort(p,p+n,greater<pa>());
		cout<<p[0].second<<" "<<p[0].first<<endl;
	}
	return 0;
}

C++: #include<iostream>
#include<vector>
using namespace std;
struct patient{
  int p, d, dd;
  bool operator<(const patient &p)const{
    return d + dd < p.d + p.dd;
  }
  bool operator>(const patient &p)const{
    return d + dd > p.d + p.dd;
  }
};


int main(int argc, char *argv[]){
  int n;
  while(std::cin >> n, n){
    vector<patient> vp;
    for (int i = 0; i < n; i++) {
      patient p;
      std::cin >> p.p >> p.d >> p.dd;
      vp.push_back(p);
    }
    sort(vp.begin(), vp.end(), greater<patient>());
    std::cout << vp[0].p << " " << vp[0].d + vp[0].dd << std::endl;
  }
  return 0;
}

C++: #include <iostream>

using namespace std;

int main()
{
    int n;

    while (cin >> n, n) {
        int max_p, max_d;
        int p, d1, d2;

        max_p = max_d = -100;
        while (n--) {
            cin >> p >> d1 >> d2;
            
            if (d1 + d2 > max_d) {
                max_d = d1 + d2;
                max_p = p;
            }
        }
        cout << max_p << " " << max_d << endl;
    }

    return 0;
}

C++: #include <iostream>
using namespace std;
int main(){
    int n;
    while(cin >> n){
        if(n==0)
            break;
        int a[n][2];
        int b; int c;
        for(int i=0;i<n;i++){
            cin >> a[i][0] >> b >> c;
            a[i][1]=b+c;
        }
        int max = a[0][1];
        int kouho =a[0][0];
        for(int i=0;i<n;i++){
            if(a[i][1] > max){
                max = a[i][1];
                kouho = a[i][0];
            }
        }
        cout << kouho << " " << max << endl;
    }
}

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

typedef struct{
	int no;
	int walk;
}Patiant;

int main(void){
	int n;
	while(cin>>n,n){
		Patiant patiant[10000];
		int inp,f,s;
		for(int i  = 0 ; i < n ; i ++){
			cin>>inp;	patiant[i].no=inp;
			cin>>f>>s; patiant[i].walk=f+s;
//			cout<<patiant[i].no<<" "<<patiant[i].walk<<endl;
		}
		for(int i = 0 ; i < n - 1 ; i ++){
			for(int j = 1 ; j < n ; j ++){
//				cout<<patiant[i].walk<<" "<<i<<" "<<patiant[j].walk<<" "<<j<<endl;
				if(patiant[i].walk<patiant[j].walk){
					Patiant tmp = patiant[i];
					patiant[i] = patiant[j];
					patiant[j] = tmp;
//					cout<<i;
				}
			}
//			cout<<endl;
		}
		
//		for(int i = 0 ; i < n ; i ++)
//				cout<<patiant[i].no<<" "<<patiant[i].walk<<endl;
		cout<<patiant[0].no<<" "<<patiant[0].walk<<endl;
	}
}

C++: #include <cstdio>
 
int main()
{
    int n;
 
    while (scanf("%d", &n), n) {
	int p, d1, d2;
	int ans = 0, num;
 
	while (n--) {
	    scanf("%d %d %d", &p, &d1, &d2);
	    if (ans < d1+d2) {
		ans = d1+d2;
		num = p;
	    }
	}
	printf("%d %d\n", num, ans);
    }
    return 0;
}

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

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

C++: #include <iostream>
#include <map>
using namespace std;
int main()
{
    while(1)
    {
        int n,p,d1,d2;
        map<int,int> pat;
        cin>>n;if(!n)return 0;
        for(int i=0;i<n;++i){
            cin>>p>>d1>>d2;
            pat.insert(make_pair(d1+d2,p));
        }
        map<int,int>::iterator it=pat.end();
        it--;
        cout<<(*it).second<<" "<<(*it).first<<endl;
    }
    return 0;
}

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

using namespace std;

int main(){
	int num, human, one, two;
	int i, j, nans, wans;
	while(cin >> num){
		if(num == 0) break;
		int tmp = 0;
		for(i = 0; i < num; ++i){
			cin >> human >> one >> two;
			if(one + two > tmp){
				tmp = one + two;
				nans = human;
				wans = tmp;
			}
		}
		cout << nans << " " << wans << endl;
 	}
	return 0;
}