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 <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <ctime>
#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 <numeric>

using namespace std;

#ifdef _MSC_VER
#define __typeof__ decltype

template <class T>
int __builtin_popcount(T n) { return n ? 1 + __builtin_popcount(n & (n - 1)) : 0; }
#endif

#define foreach(it, c) for (__typeof__((c).begin()) it=(c).begin(); it != (c).end(); ++it)
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define popcount __builtin_popcount

const double EPS = 1e-8;
typedef long long ll;
typedef pair<int, int> pint;


int main()
{
	int n;
	while (scanf("%d", &n), n)
	{
		int ap, ad = -1;
		while (n--)
		{
			int p, d1, d2;
			scanf("%d%d%d", &p, &d1, &d2);
			int d = d1 + d2;
			if (d > ad)
			{
				ad = d;
				ap = p;
			}
		}
		printf("%d %d\n", ap, ad);
	}

	return 0;
}

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

int main() {
    int n;
    while (cin >> n, n) {
        vector<pair<int,int> > v;
        int p, d1, d2;
        for (int i=0; i<n; ++i) {
            cin >> p >> d1 >> d2;
            v.push_back(make_pair(-d1-d2, p));
        }
        partial_sort(v.begin(), v.begin()+1, v.end());
        cout << v[0].second << " " << -v[0].first << endl;
    }
    return 0;
}

C++: #include <iostream>

int main(){
	int n;
	while(std::cin >> n, n){
		int max_p, max_d = 0;
		for(;n;n--){
			int p, d1, d2;
			std::cin >> p >> d1 >> d2;
			if(d1 + d2 > max_d)
				max_p = p, max_d = d1 + d2;
		}
		std::cout << max_p << " " << max_d << std::endl;
	}
}

C++: #include<iostream>
using namespace std;
int n,ans,ans2,a,b,c;
int main(){
  while(cin>>n&&n){
    cin>>a>>b>>c;
    ans=a,ans2=b+c;
    for(int i=0;i<n-1;i++){
      cin>>a>>b>>c;
      if(ans2<b+c)ans=a,ans2=b+c;
    }
    cout<<ans<<' '<<ans2<<endl;
  }
  return 0;
}

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

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

bool cmp(const P &p,const P &q){
  return p.second > q.second;
}

int main(){
  int n,id,s1,s2;
  vector<P> patient;
  while(cin >> n && n){
    patient.clear();
    for(int i=0;i<n;i++){
      cin >> id >> s1 >> s2;
      patient.push_back(P(id,s1+s2));
    }
    sort(patient.begin(),patient.end(),cmp);
    cout << patient[0].first << " " << patient[0].second << endl;

  }
  return 0;
}

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

using namespace std;

#define MAX 300000

int n, p, d1, d2;

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

		int mp = 0, md = -1;
		while(n-- > 0) {
			scanf("%d %d %d", &p, &d1, &d2);
			if(md < d1 + d2) {
				mp = p;
				md = d1 + d2;
			}
		}

		printf("%d %d\n", mp, md);
	}
}

C++: #include <cstdio>
using namespace std;
int main() {
	int n;
	while(scanf("%d",&n),n) {
		int p,d1,d2;
		int max_d=0,max_p=0;
		for(int i=0;i<n;i++) {
			scanf("%d %d %d",&p,&d1,&d2);
			if(max_d<(d1+d2)) {
				max_d=(d1+d2);
				max_p=p;
			}
		}
		printf("%d %d\n",max_p,max_d);
	}
}

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

C++: #include <iostream>

using namespace std;

int main() {

  int n;
  int p,d1,d2;

  int max_dist;
  int max_p;


  while(cin >> n) {

    if(n==0) break;

    max_dist=0;

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

      cin >> p >> d1 >> d2;

      if(d1+d2>max_dist) {

	max_dist=d1+d2;
	max_p=p;

      }

    }

    cout << max_p << " " << max_dist << endl;

  }

  return 0;

}

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

int main() {
    int n;
    while (cin >> n, n) {
        vector<pair<int,int> > v;
        int p, d1, d2;
        for (int i=0; i<n; ++i) {
            cin >> p >> d1 >> d2;
            v.push_back(make_pair(-d1-d2, p));
        }
        sort(v.begin(), v.end());
        cout << v[0].second << " " << -v[0].first << 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);
		max=0;
	}
	return 0;
}

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

int main( void )
{
    int n;

    while ( cin >> n && n != 0 )
    {
        vector <int> I( n, 0 );
        vector <int> L( n, 0 );

        for ( int i = 0; i < n; i++ )
        {
            int p, d1, d2;
            cin >> p >> d1 >> d2;
            I[i] = p;
            L[i] = d1 + d2;
        }

        int maxNo = -1;
        int maxL = 0;
        for ( int i = 0; i < n-1; i++ )
        {
            if ( i == 0 )
            {
                maxNo   = I[i];
                maxL    = L[i];
            }
            else if ( L[i] > maxL )
            {
                maxNo   = I[i];
                maxL    = L[i];
            }
        }

        cout << maxNo << " " << maxL << endl;
    }

    return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
int main(){
  while(true){
    int n;
    cin>>n;
    if(!n) break;
    int maxl=0,maxn=0;
    for(int i=0;i<n;i++){
      int p,d1,d2;
      cin>>p>>d1>>d2;
      maxl=max(maxl,d1+d2);
      if(maxl==d1+d2) maxn=p;
    }
    cout<<maxn<<" "<<maxl<<endl;
  }
  return 0;
}

C++: #include <iostream>

using namespace std;

int main(void){
int n, p, d1, d2;
int ans1,ans2;
while(1){
cin >> n;
if(n == 0){
break;
}
ans1 = -1, ans2 = -1;
for(int i = 0;i < n;i++){
cin >> p >> d1 >> d2;
if(ans2 < d1 + d2){
ans1 = p;
ans2 = d1 + d2;
}
}
cout << ans1 << ans2 << endl;
}
return 0;
}