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<stdio.h>
int main(void)
{
	int i,n,p,d1,d2,ps,d,max;
	max=-1;
	scanf("%d",&n);
	while(!(n==0)){
		p=0;
		d1=0;
		d2=0;
		max=-1;
		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\n",ps,max);
		scanf("%d",&n);
	}
	return 0;
}

C++: #include <iostream>
using namespace std;
struct {int n, d[3];} p[10000];
int main()
{
	int n, i, m, l;
	while (cin >> n && n)
	{
		for (i = 0; i < n; i++)
		{
			cin >> p[i].n >> p[i].d[0] >> p[i].d[1];
			p[i].d[2] = p[i].d[0] + p[i].d[1];
			if (i == 0 || l < p[i].d[2]) m = p[i].n, l = p[i].d[2];
		}
		cout << m << " " << l << endl;
	}
}

C++: #include<iostream>
#include<vector>
using namespace std;
int main(void){
	int n, d;

	while (1){
		n = 0;
		d = 0;
		cin >> n;
		if (n == 0)
			break;
		vector<int> p(n), d1(n), d2(n), dsum(n);

		for (int i = 0; i < n; i++){
			cin >> p.at(i) >> d1.at(i) >> d2.at(i);
			dsum.at(i) = d1.at(i) + d2.at(i);
		}

		for (int i = 0; i < n;i++){
			if (dsum.at(0) < dsum.at(i)){
				swap(dsum.at(0), dsum.at(i));
				swap(p.at(0), p.at(i));
			}
		}

		cout << p.at(0) << " " << dsum.at(0) << endl;
	}
	return 0;
}

C++: #include<cstdio>
#include<algorithm>
#include<map>
using namespace std;
int main()
{
	pair<int,int>p[10000],t;
	int n,a,b,c,i;
	while(scanf("%d",&n),n)
	{
		for(i=0;i<n;++i)scanf("%d%d%d",&a,&b,&c),p[i].first=b+c,p[i].second=a;
		t=*max_element(p,p+n);
		printf("%d %d\n",t.second,t.first);
	}
	return 0;
}

C++: #include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<map>
#include<set>
#include<queue>
#include<cstdio>
#include<climits>
#include<cmath>
#include<cstring>
#include<string>
#include<sstream>
#include<numeric>
#include<cassert>

#define f first
#define s second
#define mp make_pair

#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define rep(i,s,n) for(int i=(s); 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()
#define IN(x,s,g) ((x) >= (s) && (x) < (g))
#define ISIN(x,y,w,h) (IN((x),0,(w)) && IN((y),0,(h)))
#define print(x) printf("%d\n",x)

using namespace std;

typedef unsigned int uint;
typedef long long ll;

const int _dx[] = {0,1,0,-1};
const int _dy[] = {-1,0,1,0};

int getInt(){
  int ret = 0,c;
  c = getchar();
  while(!isdigit(c)) c = getchar();
  while(isdigit(c)){
    ret *= 10;
    ret += c - '0';
    c = getchar();
  }
  return ret;
}

int main(){
  int n;
  while(n = getInt()){
    map<int,int> m;
    REP(i,n){
      int t = getInt();
      m[getInt() + getInt()] = t;
    }
    map<int,int>::iterator it = m.end();
    it--;
    printf("%d %d\n",it->second,it->first);
  }
  return 0;
}

C++: // 2011/07/20 Tazoe

#include <iostream>
using namespace std;

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

		int max_p = -1;
		int max_d = -1;
		for(int i=0; i<n; i++){
			int p, d1, d2;
			cin >> p >> d1 >> d2;
			if(d1+d2>max_d){
				max_p = p;
				max_d = d1+d2;
			}
		}

		cout << max_p << ' ' << max_d << endl;
	}

	return 0;
}

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

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

    while(1){
        int mp = 0,md = 0;
        cin >> n;
        if(n == 0) break;
        int p,d1,d2;
        for(int i = 0; i < n; i++){
            cin >> p >> d1 >> d2;
            if(md < d1 + d2){
                md = d1 + d2;
                mp = p;
            }
        }
        cout << mp << " " << md << endl;
    }
    return 0;
}

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

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

    int n;
    while(cin >> n && n){
        int ans1 = 0;
        int ans2 = 0;
        for(int i = 0; i < n; ++i){
            int num;
            int d1, d2;
            cin >> num >> d1 >> d2;
            int d = d1 + d2;
            if(ans2 < d){
                ans1 = num;
                ans2 = d;
            }
        }
        cout << ans1 << " " << ans2 << endl;
    }

   return 0;
}

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

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    while (cin >> n, n) {
        int p, d1, d2, mp, md = 0;
        for (int i=0; i<n; ++i) {
            cin >> p >> d1 >> d2;
            if (md < d1 + d2) {
                mp = p;
                md = d1 + d2;
            }
        }
        cout << mp << " " << md << endl;
    }
    return 0;
}

C++: #include<stdio.h>
int main(void)
{
	int a,b,c,d,e,f,g=0,max=0;
	while(scanf("%d",&a),a!=0)
	{
		for(e=0;e<a;e++)
		{
			scanf("%d %d %d",&b,&c,&d);
			f=c+d;
			if(max<f)
			{
				max=f;
				g=b;
			}
		}
		printf("%d %d\n",g,max);
		max=0;
	}
	return 0;
}

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

}

C++: #include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
using namespace std;
#define REP(i, j) for(int i = 0; i < (int)(j); ++i)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define SORT(v) sort((v).begin(), (v).end())
#define REVERSE(v) reverse((v).begin(), (v).end())
typedef complex<double> P;
 
int main() {
  int N;
  while(cin >>N && N){
    map<int, int> M;
    REP(i, N){
      int a, b, c; cin >>a >>b >>c;
      M[a] = b + c;
    }
    int tar = M.begin()->first;
    for(pair<const int, int> p : M) if(M[p.first] > M[tar]) tar = p.first;
    cout <<tar <<" " <<M[tar] <<endl;
  }
  return 0;
}

C++: #include<iostream>
using namespace std;
int main() {
  int n;
  while( cin >> n, n ) {
    int num[n], one[n], two[n], sum[n];
    int maxid = 0;
    for(int i=0; i<n; i++) {
      cin >> num[i] >> one[i] >> two[i];
      sum[i] = one[i] + two[i];
      if( sum[maxid] < sum[i] ) maxid = i;
    }

    cout << num[maxid] << ' ' << sum[maxid] << endl;
  }
}