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

using namespace std;

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
template<class T> inline T sqr(T x) {return x*x;}

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;

#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,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define exist(s,e) ((s).find(e)!=(s).end())
#define range(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  range(i,0,n)
#define clr(a,b) memset((a), (b) ,sizeof(a))
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

const double eps = 1e-10;
const double pi  = acos(-1.0);
const ll INF =1LL << 62;
const int inf =1 << 29;

int main(void){
	int n;
	while(cin >> n,n){
		int cp=-1,cd=-1;
		rep(i,n){
			int p,a,b,d;
			cin >> p >> a >> b;
			d=a+b;
			if(cd<d) cd=d,cp=p;
		}
		cout << cp << " " << cd << endl;
	}
	return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
	int n,p,d[2],max=0,ID=0;
	while(cin>>n){
		if(n==0)break;
	for(int i=0;i<n;i++){
		int D=0;
		cin>>p>>d[0]>>d[1];
		D=d[0]+d[1];
		if(D>max){
			max=D;
			ID=p;
			}
		}
	cout<<ID<<" "<<max<<endl;
	}
	return 0;
}

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

int main() {
	int n;
	while (cin >> n, n) {
		map<int, string>m;
		for (int i = 0;i < n;i++) {
			string s;
			int a, b;
			cin >> s >> a >> b;
			m.insert(make_pair(a + b, s));
		}
		auto itr = m.rbegin();
		cout << itr->second << ' ' << itr->first << endl;
	}
	return 0;
}

C++: #define _USE_MATH_DEFINES
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<climits>
#include<string>
#include<vector>
#include<list>
#include<map>
#include<set>
#include<cmath>
#include<queue>
#include<cstring>
#include<stack>
#include<functional>
using namespace std;
const int INF = INT_MAX / 2;

typedef long long ll;

int N;
ll d[10], v[10];

ll GCD(ll a, ll b)
{
	if(b == 0) return a;
	return GCD(b, a % b);
}

ll LCM(ll a, ll b)
{
	return a / GCD(a, b) * b;
}

int main(){
	while(cin >> N, N)
	{
		int p, d1, d2;
		int ans_n, ans_d = -1;
		for(int i = 0; i < N; i++)
		{
			cin >> p >> d1 >> d2;
			if(d1 + d2 > ans_d) ans_n = p, ans_d = d1 + d2;
		}
		printf("%d %d\n", ans_n, ans_d);
	}
	return 0;
}

C++: #include<iostream>

using namespace std;

int main(){
	for(int n;cin>>n,n;){
		int pmax,dmax=-1;
		while(n--){
			int p,d1,d2;	cin>>p>>d1>>d2;
			if(dmax<d1+d2)	dmax=d1+d2,pmax=p;
		}
		cout<<pmax<<' '<<dmax<<endl;
	}
	return 0;
}

C++: #include<iostream>
using namespace std;
int main()
{
	int a, b, c;
	while (a == 0)
	{	
		int d[10000] = {}, sum[10000] = {};
		cin >> a;
		for (int i = 0; i < a; i++)
		{
			cin >> d[i] >> b >> c;
			sum[i] = b + c;
			for (int j = 0; j < a; j++)
			{
				if (sum[0] < sum[i])
				{
					swap(sum[i], sum[0]);
					swap(d[i], d[0]);
				}
			}

		}
		cout << d[0] << " " << sum[0] << endl;
	}
}

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

typedef struct{
  int num;
  int first;
  int second;
}Walk;

int main(){
  int n,max=-1,add;
  Walk people[10005];

  while(1){
    scanf("%d",&n);
    if(n==0) break;

    for(int i=0;i<n;i++){
      scanf("%d %d %d",&people[i].num,&people[i].first,&people[i].second);
      if(max<people[i].first+people[i].second){
	max=people[i].first+people[i].second;
	add=i;
      }
    }
    printf("%d %d\n",people[add].num,max);
    add=0;
    max=-1;
  }

  return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
typedef long long ll;
int main() {
  while(1) {
    int n;
    cin >> n;
    if(n == 0) break;
    int num, ans = 0;
    int a, b, c;
    rep(i, n) {
      cin >> a >> b >> c;
     if(ans < b + c) {
        num = a;
        ans = b + c;
      }
    }
    cout << num << " " << ans << endl;
  }
  return 0;
}

C++: //============================================================================
// Name        : AOJ.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <cstdio>
#include <string>
#include <cctype>
using namespace std;

int main() {
	int n,p,d1,d2;
	int A[10000]={},R=0,L;
	while(1){
		cin>>n;
		if(n==0)break;
		for(int i=0;i<n;i++){
			cin>>p>>d1>>d2;
			A[i]=d1+d2;
			if(R<A[i]){
				R=A[i];
				L=p;
			}
		}
		cout<<L<<" "<<R<<endl;
	}

	return 0;
}

C++: #include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cassert>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
using namespace std;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
typedef long long ll;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
int main()
{
	while(1)
	{
		int n;
		cin >> n;
		if(n == 0) return 0;
		int v = -1,x = -1;
		for(int i=0;i<n;i++)
		{
			int a,b,c; cin >> a >> b >> c;
			if(b+c > x)
			{
				v = a; x = b+c;
			}
		}
		cout << v << " " << x << endl;
	}
}

C++: #include<iostream>
#include<cstdio>
using namespace std;
int main(void)
{
    int n;
    int nn,p1,p2;
    int sum;
    int mnn=0,mpp=0;
    while(1)
    {
        cin >> n;
        if(n==0)break;
        for(int i = 0 ; i<n ; i++)
        {
            cin>>nn>>p1>>p2;
            sum=p1+p2;
            if(mpp<sum)
            {
                mnn = nn;
                mpp = sum;
            }
        }
        cout << mnn << " " << mpp << endl;
    }
    return 0;
}

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

C++: #include <iostream>
#include <cstdio>
#include <cmath>

using namespace std;

#define FOR(i,a,b) for (ll i = (a); i < (b); i++)
#define REP(i,n) FOR(i,0,n)

typedef long long ll;

int p[10000];
int d[10000];

int main(){
	int n;
	
	while (cin >> n, n){
		int ma = 0, ma_d = 0;
		REP(i,n){
			int d2;
			scanf("%d %d %d", &p[i], &d[i], &d2);
			d[i] += d2;
			
			if (ma_d < d[i]){
				ma = i;
				ma_d = d[i];
			}
		}
		
		cout << p[ma] << " " << ma_d << endl;
	}
	
	return 0;
}