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++: // clang-format off
#include <bits/stdc++.h>
#define int long long
#define main signed main()
// #define main int main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
#define stlice(from, to) substr(from, (to) - (from) + 1)
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
using namespace std;
using pii = pair<int, int>;
using vi = vector<int>;
using vd = vector<double>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vpii = vector<pii>;
using vvi = vector<vi>;
using vvb = vector<vb>;
using vvpii = vector<vpii>;
template<typename A> using fn = function<A>;
constexpr int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
constexpr int MOD = 1000000007;
constexpr double PI = acos(-1);
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
constexpr bool odd(const int &n) { return n & 1; }
constexpr bool even(const int &n) { return !odd(n); }
void solve();
main { solve(); return 0; }
// clang-format on

void solve() {
  int n;
  while (cin >> n, n) {
    vpii v;
    while (n--) {
      int p, d1, d2;
      cin >> p >> d1 >> d2;
      v.emplace_back(d1 + d2, p);
    }
    pii p = *max_element(all(v));
    cout << p.se << ' ' << p.fi << endl;
  }
}

C++: #include <iostream>

#include <queue>
using namespace std;

int main(){

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

    priority_queue< pair<int,int> > p;
    for(int i=0;i<n;i++){
      int t,d1,d2;
      cin >> t >> d1 >> d2;
      p.push( make_pair((d1+d2),t) );
    }
    cout << p.top().second << " " << p.top().first << "\n";

  }

}

C++: #include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
struct patient{
  int p, d, dd;
  bool operator<(const patient &p)const{
    return d + dd < p.d + p.dd;
  }
  bool operator>(const patient &p)const{
    return d + dd > p.d + p.dd;
  }
};


int main(int argc, char *argv[]){
  int n;
  while(std::cin >> n, n){
    vector<patient> vp;
    for (int i = 0; i < n; i++) {
      patient p;
      std::cin >> p.p >> p.d >> p.dd;
      vp.push_back(p);
    }
    sort(vp.begin(), vp.end(), greater<patient>());
    std::cout << vp[0].p << " " << vp[0].d + vp[0].dd << std::endl;
  }
  return 0;
}

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

int main() {
	while (1) {
		map<int, int>s;
		int a;
		cin >> a;
		if (a == 0)break;
		for (int b = 0; b < a; b++) {
			int  c, d, e;
			cin >> c >> d >> e;
			s.insert(pair<int, int>(d + e, c));
		}
		auto m = s.end();
		m--;
		cout << m->second <<" "<< m->first << endl;
   }
}

C++: #include<stdio.h>

int main( ){
	int people,num,one,two,anum,max;

	while(1) {
		max = 0;
		scanf( "%d" ,&people );
		if( people == 0 )break;

		for( int i = 0; i < people; i++ ){
			scanf( "%d %d %d" ,&num ,&one ,&two );
			if( max < one + two ){
				max = one + two;
				anum = num;
			}
		}
		printf( "%d %d\n" ,anum ,max );
	}
	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; 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 <iostream>
using namespace std;

int n;
int cnt;
int p[10000];
int d1, d2;
int p_sum[1000];
int p_max = 0;
int m_sum;
int p_i;

int main(){
	while(true){
		cin >> n;
		if(n == 0) break;
		for(int i = 0; i < n; i++){
			cin >> p[i] >> d1 >> d2;
			p_sum[i] = d1 + d2;
		}
		
		p_max = p_sum[0];
		for(int i = 0; i < n; i++){
			if(p_max < p_sum[i]){
				p_max = p_sum[i];
				p_i = i;
			}	
		}
		cout << p[p_i] << " " << p_max << endl;	
		p_i = 0;
	}
}

C++: #include<iostream>
#include<cmath>
using namespace std;
int main(){
    
    //変数：患者数「 n 」、患者番号「 patientsNo 」、歩いた合計距離「 sumWalk 」, 歩いた距離「walk 1 と 2」と置く
    int n, patientsNo, sumWalk, walk1, walk2;
    
    while(cin >> n, n){
        
        if( n == 0 ) break;
        
        //変数：優勝者（キング）「 king 」、最大走行距離「 maxWalk 」と置く
        int king = 0, maxWalk = 0;
        
        for(int i = 0; i < n; i++){
            
            //入力：患者番号「 patientsNo 」、歩いた合計距離「 sumWalk 」, 歩いた距離「walk 1 と 2」を入力する
            cin >> patientsNo >> walk1 >> walk2;
            
            //計算：ｎ人目の患者の合計距離を求める
            sumWalk = walk1 + walk2;
            
            //条件：キングを探す為に　➡　（　最大走行距離　が　 ｎ人目の患者の合計距離より大きいか小さいか比較している　）
            if(maxWalk < sumWalk) king = patientsNo, maxWalk = sumWalk;
        }
        
        //出力：優勝者（キング）「 king 」、最大走行距離「 maxWalk 」を出力
        cout << king << " " << maxWalk << endl;
        
    }
}

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

typedef struct{
	int no;
	int walk;
}Patiant;

int main(void){
	int n;
	while(cin>>n,n){
		Patiant input,max;
		max.walk=-1;
		int inp,f,s;
		for(int i  = 0 ; i < n ; i ++){
			cin>>inp;	input.no=inp;
			cin>>f>>s; input.walk=f+s;
			if(input.walk>max.walk)
				max=input;
			
		}
		cout<<max.no<<" "<<max.walk<<endl;
	}
}

C++: #include<iostream>
#include<vector>
#include<algorithm>

using namespace std;

struct Patient{
  int id;
  int walked;
  bool operator<(const Patient &t)const{
    return walked < t.walked;
  }
};

int main()
{
  while(true){
    int n;
    vector<Patient> v;
    cin >> n;
    if( n == 0 ) break;
    for(int i = 0; i < n; ++i){
      Patient tmp;
      int p, d1, d2;
      cin >> p >> d1 >> d2;
      tmp.id = p;
      tmp.walked = d1 + d2;
      v.push_back( tmp );
    }
    sort( v.begin(), v.end() );
    reverse( v.begin(), v.end() );
    cout << v[0].id << ' ' << v[0].walked << endl;
  }
  return 0;
}

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

class Point{
public:
  int n,walk;
  Point(int n = 0,int walk = 0):n(n),walk(walk){}
  bool operator < (const Point &s) const{ return walk > s.walk;}
};

int main(){
  int i,j,n;
  while(1){
    Point p[10000];
    cin >> n;
    if(n == 0) break;
    int a,b;
    for(i=0;i<n;i++){
      cin >> p[i].n >> a >> b;
      p[i].walk = a + b;
    }
    sort(p,p+n);
    cout << p[0].n << " " << p[0].walk << endl;

  }
  return 0;
}