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;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second

template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, pii> pip;

const ll INF = 1ll<<29;
const ll MOD = 1000000007;
const double EPS  = 1e-10;

int main() {
	int n;
	while (cin >> n, n) {
		int msum = -1, mp = -1;
		REP(i, n) {
			int p, d1, d2;
			scanf("%d %d %d", &p, &d1, &d2);
			int sum = d1 + d2;
			if (chmax(msum, sum)) mp = p;
		}
		printf("%d %d\n", mp, msum);
	}
	return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <cstdlib>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <string>
#include <cstring>
#include <cmath>
#include <complex>
#include <map>
#include <climits>
#include <sstream>
using namespace std;

#define reep(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) reep((i),0,(n))
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define EPS 1e-8
#define F first
#define S second
#define mkp make_pair

static const double PI=6*asin(0.5);
typedef long long ll;
typedef complex<double> CP;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vint;
static const int INF=1<<24;

template <class T>
void initvv(vector<vector<T> > &v,int a,int b, const T  &t = T()){
	v.assign(a,vector<T>(b,t));
}

//v.erase(unique(v.begin(),v.end()),v.end());


int main(){
	int n;
	while(cin>>n,n){
		vector<pii> v(n);
		rep(i,n){
			int a,b,c;
			cin>>a>>b>>c;
			v[i].F=b+c;
			v[i].S=a;
		}
		sort(ALL(v));
		cout<<v.back().S<<" "<<v.back().F<<endl;
	}
}

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

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
const int INF = 1<<30;

typedef pair<int, int> pii;
int main() {
  int n;
  while(cin>>n,n) {
    int ma = 0, p;
    REP(i,n) {
      int a,d1,d2;
      cin >> a >> d1 >> d2;
      if (ma < d1 + d2) {
        ma = d1 + d2;
        p = a;
      }
    }
    cout << p << " " << ma << endl;
  }
}

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

main(){
    int n, p,maxp, maxv, d1, d2;
    while(1){
	cin >> n;
	if ( n == 0 ) break;
	assert( 1 <= n && n <= 10000 );
	maxv = -1;
	for ( int i = 0; i < n; i++ ){
	    cin >> p >> d1 >> d2;
	    assert(1 <= p && p <= 10000 );
	    assert(0 <= d1 && 1 <= 5000 );
	    assert(0 <= d2 && 2 <= 5000 );
	    assert( maxv != d1 + d2 );
	    if ( maxv < d1 + d2 ){
		maxp = p;
		maxv = d1 + d2;
	    }
	}
	cout << maxp << " " << maxv << endl;

    }
}

C++: #include<algorithm>
#include<functional>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<string>
#include<sstream>
#include<iostream>
#include<iomanip>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<bitset>
#include<climits>

#define all(c) (c).begin(), (c).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define pb(e) push_back(e)
#define mp(a, b) make_pair(a, b)
#define fr first
#define sc second

typedef unsigned long long UInt64;
typedef long long Int64;

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

using namespace std;

typedef pair<int ,int > P;

void solve(int n)
{
	vector<P> vec;
	rep(i,n)
	{
		int p,d1,d2;
		cin>>p>>d1>>d2;
		vec.pb(P(d1+d2,p));
	}

	sort(all(vec),greater<P>());

	vector<P>::iterator it = vec.begin();

	cout<<it->fr<<" "<<it->sc<<endl;

}

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

		solve(n);
	}
		return 0;
}

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

int main(void){
	int n;
	int a,b,c;
	while(cin>>n,n){
		std::map<int,int> m;
		for(int i=0;i<n;i++){
			cin>>a>>b>>c;
			m[a]=b+c;
		}
		__typeof(m.begin()) res=m.begin();
		for(__typeof(m.begin()) it=m.begin();it!=m.end();it++){
			if(res->second<it->second)res=it;
		}
		cout<<res->first<<" "<<res->second<<endl;
	}
	return 0;
}

C++: #include<iostream>
using namespace std;
int main()
{
	int a, b, c;
	while (cin >> a,a != 0)
	{	
		int d[10000] = {}, sum[10000] = {};
		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<algorithm>
using namespace std;

int main(){

  int n;

  while(cin >> n, n){
    int a[10000] = {0},x,y,p;

    for(int i=0;i<n;i++){
    cin >> p >> x >> y;

    a[p] = x + y;
    }

    p = 2;

    for(int i=2;i<=10000;i++){
      if(a[1] < a[i]){
	a[1] = a[i];
	p = i;
      }
    }

    cout << p << " " << a[1] << endl;

  }
}

C++: #include <iostream>
#include <math.h>
#include <stdio.h>
#include <string>
#include <string.h>
#include <algorithm>
#include <cmath>
#include <limits>
#include <sstream>

using namespace std;

int main (void)
{
	for (int u = 0; u < 50; u++)
	{
		long n;
		long id[10000],a[10000],b[10000];
		int p = -1;
		int q = 0;

		cin >> n;
		if (n == 0)
		{
			break;
		}

		for (long i = 0; i < n; i++)
		{
			cin >> id[i] >> a[i] >> b[i];
		}

		for (long i = 0; i < n; i++)
		{
			if (a[i] + b[i] > q)
			{
				p = 0;
				p = id[i];
				q = 0;
				q = a[i] + b[i];
			}
		}

		cout << p << " " << q << endl;
	}
}

C++: #include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <ostream>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define INF 1000000000
#define rep(i,a,b) for (int i=(a);i<(b);i++)
#define rev(i,a,b) for (int i=(a)-1;i>=b;i--)
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef queue<int> qi;
typedef vector<int> vi;
typedef vector<string> vs;
int dx[4] = { 0, 1, 0, -1 };
int dy[4] = { 1, 0, -1, 0 };

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);

  int n;

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

    int num, max = -1;
    rep(i,0,n) {
      int id,d1,d2;
      cin >> id >> d1 >> d2;
      if(max < d1+d2) {
        max = d1+d2;
        num = id;
      }
    }
    cout << num << " " << max << endl;
  }

	return 0;
}