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 _USE_MATH_DEFINES
#define INF 10000000
#include <iostream>
#include <sstream>
#include <cmath>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>

using namespace std;

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

static const double eps = 1e-8;

int main(){
	int n;	
	while(~scanf("%d",&n)){	
		if(n==0) break;
		priority_queue<P> que;
		for(int i=0;i<n;i++){
			int p,d1,d2;
			scanf("%d %d %d",&p,&d1,&d2);
			que.push(P(d1+d2,p));
		}

		printf("%d %d\n",que.top().second,que.top().first);
	}
}

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

using namespace std;

int main(){

	int n;
	while(cin>>n&&n!=0){
		int maxNum=-1;
		int idx;
		for(int i = 0; i < n; i++){
			int p,d1,d2;
			cin>>p>>d1>>d2;
			int sum=d1+d2;
			if(maxNum<sum){
				maxNum=sum;
				idx=p;
			}
		}
		cout<<idx<<" "<<maxNum<<endl;
	}

	return 0;
}

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

C++: #include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
template<class T>
using Table = vector<vector<T>>;
const ld eps=1e-9;

//// < "D:\D_Download\Visual Studio 2015\Projects\programing_contest_c++\Debug\a.txt"
int main() {
	while (1) {
		int  N; cin >> N;
		if (!N)break;
		int amax = -1;
		int id = 0;
		for (int i = 0; i < N; ++i) {
			int p, d1, d2; cin >> p >> d1 >> d2;
			if (amax < d1 + d2) {

				id = p;
				amax = d1 + d2;
			}

		}
		cout << id<< " "<<amax<< endl;
	}
	
	return 0;
}

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

C++: #include<iostream>

using namespace std;

int main()
{
	int n;
	int i;
	
	for(;;)
	{
		cin >> n ;
		if(n==0)
			break;
		
		int ans1,ans2=0;
		for(i=0;i<n;i++)
		{
			int m,a,aa;
			cin >> m >> a >> aa ;
			if(a+aa>ans2)
			{
				ans1=m;
				ans2=a+aa;
			}
		}
		cout << ans1 << " " << ans2 << endl;
	}
}

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

C++: 
#include <bits/stdc++.h>
#include <stdio.h>
#include <numeric>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define repone(i,n) for(int i=1;i<(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define Rep(j,n) for(int j=0;j<(int)(n);++j)
#define Repo(j,o,n) for(int j=o;j<(int)(n);++j)
#define Repone(j,n) for(int j=1;j<(int)(n);++j)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define int long long
#define pb(a) push_back(a)
#define pbpair(a,b) push_back(make_pair(a,b))
#define MOD 1000000007
#define INF 9223372036854775807
#define pairint pair<int,int>
int gcd( int x, int y ){ return y ? gcd(y, x%y) : x; }
signed main() {
int x=0,y=0,z=0,w=0,n=0,m=0;
int a=0,b=-1,c=0,d=0;
while (true) {
  std::cin >> n;
  if(n==0)break;
  b=-1;
rep(i,n){
  std::cin >> x>>y>>z;
  if(b<y+z){
    a=x;
    b=y+z;
  }
}

        printf("%d %d\n",a,b);
      }
}

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

int main()
{
    int n, a, b, c;

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

        int r1 = 0, r2 = 0;
        for( int i = 0; i < n; i++ )
        {
            cin >> a >> b >> c;
            if( b + c > r2 )
            {
                r1 = a;
                r2 = b + c;
            }
        }
        cout << r1 << " " << r2 << 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 <algorithm>
#include <cassert>
#include <cctype>
#include <complex>
#include <cstdio>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;

int n,p,d1,d2;
pair<int,int> pa[10000];

int main(){
	while(cin>>n){
		if(!n)return 0;
		for(int i=0;i<n;i++){
			cin>>p>>d1>>d2;
			pa[i]=make_pair(d1+d2,p);
		}
		sort(pa,pa+n);
		cout<<pa[n-1].second<<" "<<pa[n-1].first<<endl;
	}
}

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

using namespace std;

int main(){

	int n;
	int p,d1,d2;
	int max_n,max_i;

	while(1){

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

		max_i=-1;
		max_n=-1;

		for(int i=0;i<n;i++){
			cin>>p>>d1>>d2;
			if(d1+d2>max_n){
				max_n=d1+d2;
				max_i=p;
			}
		}

		cout<<max_i<<" "<<max_n<<endl;
	}

}

C++: #define _USE_MATH_DEFINES
#include "bits/stdc++.h"
using namespace std;

//#define int long long
#define DBG 1
#define dump(o) if(DBG){cerr<<#o<<" "<<o<<endl;}
#define dumpc(o) if(DBG){cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define each(it,c) for(auto it=(c).begin();it!=(c).end();it++)
#define all(c) c.begin(),c.end()
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9 + 7);

signed main() {
	int n;
	while (cin >> n, n) {
		vector<int>v(10001,0);
		rep(i, 0, n) {
			int p, a, b; cin >> p >> a >> b;
			v[p] = a + b;
		}
		auto it = max_element(all(v));
		cout << distance(v.begin(), it) << " " << *it << endl;
	}
	return 0;
}

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

C++: #include<bits/stdc++.h>
using namespace std;
int main() {
	int n, p, maxp, maxv, d1, d2;
	while (cin >> n && n) {
		maxv = -1;
		for (int i = 0; i < n; i++) {
			cin >> p >> d1 >> d2;
			if (maxv < d1 + d2) {
				maxp = p;
				maxv = d1 + d2;
			}
		}
		cout << maxp << " " << maxv << endl;
	}
	return 0;
}

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

int main(void){
	int n;
	while(cin>>n && n){
		int maxP=-1,maxD=0;
		for(int i=0;i<n;i++){
			int p,d1,d2;
			cin>>p>>d1>>d2;
			if(maxD < d1 + d2){
				maxP = p;
				maxD = d1 + d2;
			}
		}

		cout<<maxP<<" "<<maxD<<endl;
	}

	return 0;
}