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 all(c) (c).begin(),(c).end()
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define iter(c) __typeof((c).begin())
#define tr(it,c) for(iter(c) it=(c).begin(); it!=(c).end(); it++)
#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)
#define pr(a) cout << (a) << endl
typedef long long ll;
typedef pair<int,int> P;
const int MAX=1000000000;
int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

int main() {
  int n;
  while(cin >> n && n) {
    int ans,max=0;
    rep(i,n) {
      int a,b,c;
      cin >> a >> b >> c;
      if(b+c>max) {
	ans=a;
	max=b+c;
      } 
    }
    cout << ans << " " << max << endl;
  }
  return 0;
}

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

using namespace std;

struct Patient {
	int name;
	int d[3];
};

bool compare(Patient i, Patient j) {
	return (i.d[2] < j.d[2]);
}

int main() {
	
	int n;

	while (cin >> n && n != 0) {

		Patient *patient = new Patient[n];

		for (int i = 0; i < n; i++) {

			cin >> patient[i].name >> patient[i].d[0] >> patient[i].d[1];
			patient[i].d[2] = patient[i].d[0] + patient[i].d[1];

		}

		sort(patient, patient + n, compare);

		cout << patient[n - 1].name << " " << patient[n - 1].d[2] << "\n";
		delete patient;
		patient = NULL;
		
	}

	return 0;

}

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

typedef struct P {
	int p, d;
	bool operator<(const P &r) {
		return d < r.d;
	}
} P;
int n;;

int main(){
	int p, d1, d2;
	while (cin >> n && n != 0) {
		P m = { 0,-1 };
		P t;
		for (int i = 0; i < n; i++) {
			cin >> p >> d1 >> d2;
			t = { p,d1 + d2 };
			if (m < t) {
				m = t;
			}
		}
		cout << m.p << " " << m.d << endl;
	}

	return 0;
}

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

using namespace std;
typedef pair<int, int> P;

void solve()
{
	int n;
	while(cin >> n, n)
	{
		vector<P> Vec;
		for(int i = 0; i < n; ++i)
		{
			int num, day1, day2;
			cin >> num >> day1 >> day2;
			Vec.push_back(make_pair(day1 + day2, num));
		}
		sort(Vec.begin(), Vec.end());
		cout << Vec[Vec.size() - 1].second << " " << Vec[Vec.size() - 1].first << endl;
	}
}

int main()
{
	solve();
	return(0);
}

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

	while(true){

		int n;
		int p,d1,d2;
		int max = 0,pmax = 0;
		
		cin >> n;
		if(n==0)
			break;

		for(int i=0 ;i<n ;i++){

			cin >> p >> d1 >> d2;

			if(i==0){
				max = d1 + d2;
				pmax = p;
			}
			else if(max < (d1 +d2)){
				max = d1 + d2;
				pmax = p;
			}
		}

		cout << pmax  << ' ' << max << endl;
	}
	return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#define rep(i,n) for(int i=0;i<(int)n;i++)

using namespace std;



int main()
{
	int n;
	cin>>n;
	while(n!=0)
	{
	vector< pair<int,int> > a;
	rep(i,n)
	{
		int z,x,c;
		cin>>z>>x>>c;
		a.push_back(pair<int,int>(x+c,z));
	}
	
	sort(a.begin(),a.end());
	
		cout<<a[a.size()-1].second<<" "<<a[a.size()-1].first<<endl;
		cin>>n;
	}
}

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

using namespace std;

typedef long long ll;
typedef pair<int,int>P;

#define INF 2<<29
#define F first
#define S second

int main(){
  int n;
  int sum=0;
  int ansp;
  int p,d1,d2;
  while(1){
    scanf("%d",&n);
    if(n==0) break;
    sum=0;
    for(int i=0;i<n;i++){
      scanf("%d %d %d",&p,&d1,&d2);
      if(sum<d1+d2){
	ansp=p;
	sum=d1+d2;
      }
    }
    printf("%d %d\n",ansp,sum);
  }

  return (0);
}

C++: /* 00:08 - 12:00 */
#include <iostream>
using namespace std;
int main(){
	int n,ret,p,a,b;
	
	while(cin >> n , n){
		pair<int,int> ret = make_pair(0,0) ;
		for(int i=0;i<n;i++){
			cin >> p >> a >> b;
			ret = max(ret,make_pair(a+b,p));
		}
		cout << ret.second << " " << ret.first << endl;
	}
}

C++: #include <bits/stdc++.h>
#define rep(i,l,n) for(int i=l;i<n;i++)
#define rer(i,l,n) for(int i=l;i<=n;i++)
#define all(a) a.begin(),a.end()
#define o(a) cout<<a<<endl
#define pb(a) push_back(a)
#define mk(a,b) make_pair(a,b)
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;

int main(){
	int n;
	while(1){
		cin>>n;
		if(n==0) break;
		pii d[10001]={};
		int p,a,b;
		rep(i,0,n){
			cin>>p>>a>>b;
			d[i].fi=a+b; d[i].se=p;
		}
		sort(d,d+n);
		reverse(d,d+n);
		o(d[0].se<<" "<<d[0].fi);
	}
}

C++: #include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  while(n!=0){
    int a,b,c;
    int mx=0,mn=0;
    for(int i=0;i<n;i++){
      cin>>a>>b>>c;
      mx=max(mx,c+b);
      if(mx==c+b){
	mn=a;
      }
    }
    cout<<mn<<' '<<mx<<endl;
    cin>>n;
  }
  return 0;
}

C++: #include<iostream>
#include<vector>
#include<map>
#include<queue>
#include<functional>
using namespace std;
typedef pair<int,int> P;
int main(){
	int n,p,x,y;
	while(cin>>n,n){
		priority_queue<P> vec;
		for(int i=0;i<n;i++){
			cin>>p>>x>>y;
			vec.push(P(x+y,p));
		}
		P now=vec.top();
		cout<<now.second<<' '<<now.first<<endl;
	}
	return 0;
}

C++: #include <iostream>

using namespace std;

int main() {

  while(1) {

    int n;
    cin >> n;
    if(n == 0) break;

    int maxd = -1;
    int maxp;
    int p,d1,d2;

    for(int i=0;i<n;i++) {

      cin >> p >> d1 >> d2;

      if(maxd < d1 + d2) {
	maxd = d1+d2;
	maxp = p;
      }
    }

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

  }

  return 0;

}

C++: #include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstring>
using namespace std;
static const double EPS = 1e-5;
typedef long long ll;


map<int,int> kyori;

int main(){
	int n;
	
	while(cin>>n){
		if(n==0)break;
		
		kyori.clear();
		int max,maxno;
		for(int i=0;i<n;i++){
			int p,d1,d2;
			cin>>p>>d1>>d2;
			kyori[p]=d1+d2;
			max=d1+d2;
			maxno=p;
		}
		
		for(map<int,int>::iterator p=kyori.begin();p!=kyori.end();++p){
			if(p->second>max){
				max=p->second;
				maxno=p->first;
			}
		}
		cout<<maxno<<" "<<max<<endl;
	}
	return 0;
}

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

  return 0;
}