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 <vector>
#include <algorithm>
using namespace std;

int main(){

  int n;

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

  return 0;
}

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;
  }
}

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

return 0;
}

C++: #include<iostream>

using namespace std;


int main(){
	int n;
	while(cin>>n,n){
	int maxi=-INF;
	int ans=0;
	for(int i=0; i<n;i++){
	int a,b,c; cin>a>>b>>c;
	if(maxi<b+c){
		maxi=b+c;
		ans=a}
		}
	cout<<ans<<" "<<maxi<<endl;	
	}
}

C++: #include <cstdio>
#include <iostream>
#include <iomanip>
#include <string> 
#include <vector> 
using namespace std;
  
int main(){
    /*??£???????????????????????????
            int a[2];
            cin >> a[1] >> a[2];
            cout << "[+] " << a[1] + a[2] << endl;
            cout << "[-] " << a[1] - a[2] << endl;
            cout << "[*] " << a[1] * a[2] << endl;
            cout << "[/] " << a[1] / a[2] << endl;
    */

    int a,ans[2];
    while(cin >> a){
    if(a == 0){break;}
    int p[a][3];
    for(int i = 1;a >= i;i++){
        cin  >> p[i][0] >> p[i][1] >> p[i][2];
        if(i == 1){
            ans[0] = p[i][0];
            ans[1] = p[i][1] + p[i][2];            
        }       
        for(int ii = 1;i > ii;ii++){
            if(ans[1] < p[i][0] + p[i][2]){
                ans[0] = p[i][0];
                ans[1] = p[i][1] + p[i][2];
            }
        }
    }
    cout << ans[0] << " " <<  ans[1] << endl;

    }
}

C++: #include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> pe;
int main(void)
{
	int i,j,k,n;

	while(1) {
		cin>>n;	
		vector<pair<int,int> > pp(n);
		if(n==0) break;
		for(i=0;i<n;i++) {
			int a,b;
			cin>>pp[i].second>>a>>b;
			pp[i].first=a+b;
		}
		sort(pp.begin(),pp.end());
		cout<<pp[n-1].second<<" "<<pp[n-1].first<<endl;
	}
}

C++: #include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
using namespace std;

int main() {
  int n;
  for(;;) {
    cin >> n;
    if(n == 0) break;
    int p, d1, d2, num, dis = 0;
    for(int i=0; i<n; ++i) {
      cin >> p >> d1 >> d2;
      if(max(dis, d1 + d2) == d1 + d2) {
        num = p;
        dis = d1 + d2;
      }
    }
    cout << num << " " << dis << endl;
  }
}

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

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

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

int main(void){
  int count=0;
  while(1){
  cin >> count;
  if(count == 0) break;
  else{
    int maxkan,maxkyori=-1,kan=0,kyori1=0,kyori2=0;
    for(int i=0;i<count;i++){
      cin >> kan >> kyori1 >> kyori2;
       if(maxkyori < kyori1+kyori2){
         maxkan = kan;
         maxkyori = kyori1+kyori2;
       }
    }
    cout << maxkan << " " << maxkyori << endl;
   } 
  }
}

C++: #define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <cstdio>
#include <vector>
#include <string>
#include <array>
#include <queue>
#include <deque>
#include <set>
#include <unordered_set>
#include <list>
#include <map>
#include <stack>
#include <utility>
#include <bitset>
#include <complex>
#include <algorithm>
#include <numeric>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <cstring>
#include <climits>
#include <random>
#include <functional>
#include <sstream>
#include <iomanip>

using namespace std;

#define rep(i, n) for(int i=0; i<(n); ++i)
#define FOR(i, m, n) for(int i=(m); i<(n); ++i)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define SORT(x) sort((x).begin(),(x).end())
#define REVE(x) reverse((x).begin(),(x).end())
#define mp make_pair
#define pb push_back
#define Cout(x) cout << (x) << endl
#define Cout2(x, y) cout << (x) << " " << (y) << endl
#define dump(x) cout << #x << " = " << (x) << endl;
#define forauto(i, a) for(auto i : a)cout << i << " "; puts("");

typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef vector<vector<int>> VVI;
typedef pair<int, int> PII;
typedef pair<double, double> PDD;
typedef complex<double> CD;

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

		int maxp, maxd = 0;
		rep(i, n) {
			int p, d1, d2; cin >> p >> d1 >> d2;
			if (maxd < d1 + d2) {
				maxp = p;
				maxd = d1 + d2;
			}
		}
		Cout2(maxp, maxd);
	}
}

C++: #include <cstdio>

int n;

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

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

int solve_testcase() {
  int N; cin >> N;
  if(N == 0) return 1;

  vector<int> P(N), d1(N), d2(N);
  int max_val = -1, ans = -1;
  for(int i=0; i<N; i++) {
    cin >> P[i] >> d1[i] >> d2[i];
    if(d1[i] + d2[i] > max_val) {
      max_val = d1[i] + d2[i];
      ans = P[i];
    }
  }
  cout << ans << " " << max_val << endl;
  return 0;
}

int main() {
  while(!solve_testcase());
  return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define pp pair<int,int>
#define ll long long
#define ld long double
int inf=100000000;
ll INF=5000000000000000000;
ll MOD=1000000007;


int main() {
    while (true){
    int n;
    cin >> n;
    if (n==0) break;
    vector<pp> a(n);
    int y,u,t;
    rep(i,n){
        cin >> t >> y >> u;
        a.at(i).first=y+u;
        a.at(i).second=t;
    }
    sort(a.begin(),a.end());
    reverse(a.begin(),a.end());
    cout << a.at(0).second << " " << a.at(0).first << endl;
}
}

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