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 _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <stdio.h>
#include <algorithm>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
using namespace std;
int main() {
	int n;
	while (true) {
		scanf("%d", &n);
		if (n == 0) break;
		int dp[10001] = {};
		for (int i = 0;i < n;++i) {
			int a, b, c;
			scanf("%d%d%d", &a, &b, &c);
			dp[a] = b + c;
		}
		int maxnow = 0;
		for (int i = 0;i < 10001;++i) {
			if (dp[maxnow] < dp[i]) {
				maxnow = i;
			}
		}
		printf("%d %d\n", maxnow, dp[maxnow]);
	}
}

C++: #include <iostream>
#include <cstring>
#include <cstdlib>
#include <algorithm>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,b) FOR(i,0,b)
#define PB push_back
#define MP make_pair
int main(){
  int n;
  while(cin>>n,n){
    int ans[2];
    ans[1]=0;
    for(int i=0;i<n;i++){
      int id,d1,d2;
      cin>>id>>d1>>d2;
      if(ans[1]<d1+d2){
        ans[0]=id;
        ans[1]=d1+d2;
      }
    }
    cout<<ans[0]<<" "<<ans[1]<<endl;
  }
}

C++: // 2010/12/22 Tazoe

#include <iostream>
using namespace std;

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

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

		cout << p_max << ' ' << d_max << endl;
	}

	return 0;
}

C++: #include<stdio.h>

int main(){

int x,y,z,N,p;
int max=0,sum=0;

while(1){
scanf("%d",&N);if(N==0)break;
for(int i=0;i<N;i++){
scanf("%d %d %d",&p,&x,&y);
if(max<x+y){max=x+y;sum=p;}
}
printf("%d %d\n",sum,max);
sum=0;max=0;
}
return 0;
}

C++: #include <cstdio>

typedef struct {
	int p, sum;
} Data;

Data fmax_Data(Data x, Data y) {
	return x.sum > y.sum ? x : y;
}

int fmax(int x, int y) {
	return x > y ? x : y;
}

int main(void) {
	while(true) {
		int n;
		scanf("%d", &n);
		if(n == 0)
			break;
		Data max = {0, 0};
		for(int i = 0; i < n; i++) {
			int p, q, r, sum;
			Data t;
			scanf("%d %d %d", &p, &q, &r);
			sum = q + r;
			t.p = p;
			t.sum = sum;
			max = fmax_Data(max, t);
		}
		printf("%d %d\n", max.p, max.sum);
	}
	return 0;
}

C++: // 2013/09/17 Tazoe

#include <iostream>
using namespace std;

int main()
{
	while(true){
		int n;
		cin >> n;

		if(n==0)
			break;

		int p_max = -1;
		int d_max = -1;
		for(int i=0; i<n; i++){
			int p, d1, d2;
			cin >> p >> d1 >> d2;

			int d = d1+d2;

			if(d>d_max){
				p_max = p;
				d_max = d;
			}
		}

		cout << p_max << ' ' << d_max << 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 <cstdio>
#include <vector>

using namespace std;

int main(){
	int n;
	while(scanf("%d",&n) != EOF && n != 0){
		int max,id;
		int self;
		int p,d1,d2;
		max = -1;
		id = -1;
		for(int i=0;i<n;i++){
			scanf("%d %d %d",&p,&d1,&d2);
			self = d1+d2;
			if( max < self){
				max = self;
				id = p;
			}
		}
		printf("%d %d\n",id,max);
		
	}
	return 0;
}

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

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

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

int main(){
	string s;
	int cnt = 0;
	while(getline(cin, s)){
		++cnt;
		if(s.empty()){
			cerr << cnt << endl;
		}
	}
}

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<<p<<" "<<maxd<<endl;
	}
	return 0;


		
}

C++: #include <bits/stdc++.h>
using namespace std;

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

#define pb push_back
#define in ,
#define rep(i, a, n) for(int i = (a); i < (n); i++)
#define dep(i, a, n) for(int i = (a); i >= (n); i--)
#define mod 1e9+7

__attribute__((constructor))
void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}

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

C++: #include<stdio.h>

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

C++: #include<stdio.h>
int main(void)
{
	int n,a[1000],s,d,max,z,x[1000],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(j=0;j<n;j++){
		if(max<x[i])	{
				max=x[i];
				z=a[i];
		}
	}	
	printf("%d %d\n",z,max);
   }
  return 0;
}

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

int main(){
	int n;
	while(cin >> n && n){
		int o = -1 , p = -1 , u = 0 , c = 0 , t = 0;
		for(int i = 0 ; i < n ; i++){
			cin >> u >> c >> t;
			int d = c + t;
			if(d > o){
				p = u;
				o = d;
			}
		}
		cout << p << " " << o << endl;
	}
}

C++: #include<vector>
#include<list>
#include<algorithm>
#include<iostream>
#include<string>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
using namespace std;
int main(){
  int i;
  int n,b,c,d,e,f;
  while(cin>>n&&n){
    f=-1;
    for(i=0;i<n;i++){
      cin>>b>>d>>e;
      if(f==-1||f<d+e){
	f=d+e;
	c=b;
      }
    }
    cout<<c<<" "<<f<<endl;
  }
  return 0;
}

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

int main(){
	int d;
	while(cin>>d&&d){
		int *MAX_p,*MAX_d,zero_d=0,zero_p=0;
		{//init
			MAX_p=&zero_p;MAX_d=&zero_d;
		}
		for(int p,d1,d2;d--;){
			cin>>p>>d1>>d2;
			if(*MAX_d<d1+d2){
				*MAX_d=d1+d2;
				*MAX_p=p;
			}
		}
		cout<<*MAX_p<<" "<<*MAX_d<<endl;
	}
}

C++: #include<iostream>

using namespace std;

typedef struct{
	int num;
	int len;
}kanzya;

int main(void){
	std::ios_base::sync_with_stdio();

	int n;
	int p,d1,d2;
	kanzya data;

	while(1){
		cin>>n;
		if(n==0) break;
		cin>>p>>d1>>d2;
		data.num=p;
		data.len=d1+d2;
		n--;
		while(n--){
			cin>>p>>d1>>d2;
			if(data.len<d1+d2){
				data.num=p;
				data.len=d1+d2;
			}
		}
		cout<<data.num<<" "<<data.len<<endl;
	}

	return 0;
}