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 <iostream>
#include <algorithm>
using namespace std;
int main() {
  int N;
  
  while(cin >> N && N) {
    int mx = 0;
    int mid;
    for(int i=0; i<N; i++) {
      int id; cin >> id;
      int a, b; cin >> a >> b;
      if(mx < a+b) {
	mx = a+b;
	mid = id;
      }
    }
    cout << mid << " " << mx << endl;
  }
  
  return 0;
}

C++: #include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(b) - 1;i>=(a);i--)
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)

#define PB push_back
#define INF INT_MAX/3
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define CLR(a) memset(a,0,sizeof(a))

typedef long long int ll;

using namespace std;

int main(){
    while(true){
	int n;
	cin >> n;
	if(n==0) break;
	vector< pair<int,int> > patients;
	REP(i,n){
	    int p,d1,d2;
	    cin >> p >> d1 >> d2;
	    patients.PB(pair<int,int>(d1+d2,p));
	}
	sort(RALL(patients));
	cout << patients[0].second << " " << patients[0].first << endl;
    }
    return 0;
}

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


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

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",ps,max);
		printf("\n");
		scanf("%d",&n);
	}
	return 0;
}

C++: #include<bits/stdc++.h>
#define endl '\n'
#define INF (1 << 21)
const int MOD = 1000000009;
using namespace std;
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  int p;
  int d1, d2;
  int a_num, ans;
  
  
  cin >> n;

  while(n != 0){
    ans = -1;
    for(int i = 0;i < n;i++){
      cin >> p >> d1 >> d2;
      
      if(d1 + d2 > ans){
	ans = d1 + d2;
	a_num = p;
      }
    }
    cout << a_num << ' ' << ans << endl;
    cin >> n;
  }
         
  return 0;
}

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

int main() {
	int n;
	while(cin >> n, n) {
		int id, dis;
		id = -1, dis = -1;
		for(int i = 0; i < n; i++) {
			int p;
			int d1, d2; cin >> p >> d1 >> d2;
			if(dis < d1+d2) {
				id = p; dis = d1+d2;
			}
		}
		cout << id << " " << dis << endl;
	}
}

C++: #include<iostream>
#include<algorithm>
#include<map>
#define F first
#define S second
using namespace std;

int main(){
  
  int n, id, d1, d2;
  pair <int, int> p[11111];
  
  while(cin >> n, n){
    for(int i=0;i<n;i++) cin >> id >> d1 >> d2, p[id].F = d1 + d2, p[id].S = id;
    sort(p, p+11111);
    reverse(p, p+11111);
    cout << p[0].S << " " << p[0].F << endl;
  }
}

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

C++: using namespace std;
#include <iostream>
#include <string>
#include <set>
#include <functional>
#include <vector>
#include <algorithm>
#include <stdio.h>
int main()
{
	int n;
	while(cin>>n&&n){
		pair<int,int> 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<pair<int,int>>());
		cout<<p[0].second<<" "<<p[0].first<<endl;
	}
	return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
	int n,p,d1,d2,maxp,maxv;
	while(1){
		cin >> n
		if(n == 0) break;
		maxp = maxv = 0;
		while(n --){
			cin >> p >> d1 >> d2;
			if(maxv < d1+d2){
				maxp = p;
				maxv = d1+d2;
                                }
		}
		cout<< maxp << maxv;
	}
}

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

C++: #include <stdio.h>

#define MYSCAN scanf

int main(void){
	int n, p, d1, d2, king, record;

	while (true){
		king = -1;
		record = -1;

		MYSCAN("%d", &n);
		if (n == 0){ break; }
		for (int i = 0; i < n; i++){
			MYSCAN("%d%d%d", &p, &d1, &d2);
			if (record < d1 + d2){
				record = d1 + d2;
				king = p;
			}
		}
		printf("%d %d\n", king, record);
	}	
	return 0;
}

C++: #include <iostream>

using namespace std;

int main() {
  for (;;) {
    int n;
    cin >> n;
    if (!n) return 0;
    int r = 0, d = 0;
    for (int i = 0; i < n; i++) {
      int p, d1, d2;
      cin >> p >> d1 >> d2;
      if (d < d1 + d2) {
        d = d1 + d2;
        r = p;
      }
    }
    cout << r << ' ' << d << endl;
  }
}

C++: #include<iostream>
#include<algorithm>
#include<functional>
using namespace std;
int main(){
	int n;
	while(cin>>n,n){
		int ans=0,most=-1,tmp,t1,t2;
		for(int i=0;i<n;i++){
			cin>>tmp>>t1>>t2;
			if(most<t1+t2){
				most=t1+t2;
				ans=tmp;
			}
		}
		cout<<ans<<" "<<most<<endl;
	}
	return 4545454545454454545454;
}