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>
using namespace std;
int main(void){
    int n,ans,ans2,a,b,c;
    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 <bits/stdc++.h>
using namespace std ;

#define pb(n) push_back(n)
#define fi first
#define se second
#define all(r) (r).begin(),(r).end()
#define gsort(st,en) sort((st),(en),greater<int>())
#define vmax(ary) *max_element(all(ary))
#define vmin(ary) *min_element(all(ary))
#define debug(x) cout<<#x<<": "<<x<<endl
#define fcout(n) cout<<fixed<<setprecision((n))
#define scout(n) cout<<setw(n)
#define vary(type,name,size,init) vector< type> name(size,init)

#define rep(i,n) for(int i = 0; i < (int)(n);++i)
#define REP(i,a,b) for(int i = (a);i < (int)(b);++i)
#define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it)
#define repa(n,array) for(auto &n :(array))

using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using dict = map<string,int>;
using pii = pair<int,int> ;

const int mod = 1000000007;
constexpr int imax = ((1<<30)-1)*2+1 ;
constexpr int inf = 100000000;
constexpr double PI = acos(-1.0) ;
double eps = 1e-10 ;
const int dy[] = {-1,0,1,0};
const int dx[] = {0,-1,0,1};

inline bool value(int x,int y,int w,int h){
  return (x >= 0 && x < w && y >= 0 && y < h);
}

template<typename T>
void Unique(vector<T> &v){
  sort(all(v));
  v.erase(unique(all(v)),v.end());
}

template<typename T>
T ston(string& str, T n){
  istringstream sin(str) ;
  T num ;
  sin >> num ;
  return num ;
}

void Ans(bool f){
  if(f) cout << "YES"<<endl;
  else cout << "NO"<<endl;
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n;
  while(cin >> n &&n){
    vector<pii> v(n,make_pair(0,0));
    ll a,b,c;
    rep(i,n){
      cin >> a >> b >> c;
      v[i].fi = a;
      v[i].se = b + c;
    }
    sort(all(v),[](const pii &a,const pii &b){
          return a.se > b.se;
        });
    cout << v[0].fi << " " << v[0].se << endl;
  }
  return 0;
}

C++: #define scanf_s scanf
#include <stdio.h>
#include <string>
#include <math.h>
#include <stack>
#include <queue>
#include <list>
#include <vector>
#include <iostream>
using namespace std;

#define MAX 100000

int main()
{
	int n, max, maxi = 0, p, d1, d2,d;
	while (1) {
		scanf_s("%d", &n);
		if (n == 0)break;
		for (int i = 0; i < n; ++i) {
			scanf_s("%d %d %d", &p, &d1, &d2);
			d = d1 + d2;
			if (i == 0 || max < d) {
				max = d;
				maxi = p;
			}
			printf("%d %d\n", maxi, max);
		}
	}
}

C++: #include<iostream>
#include<iomanip>
#include<algorithm>
#include<array>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<functional>
#include<limits>
#include<list>
#include<map>
#include<numeric>
#include<set>
#include<stack>
#include<string>
#include<sstream>
#include<unordered_map>
#include<queue>
#include<vector>
using namespace std;

//#define int long long
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;

#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(a) (a).begin(),(a).end()
#define dump(o) {cerr<<#o<<" "<<o<<endl;}
#define dumpc(o) {cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL
const int MOD = 1e9 + 7;

signed main() {
	int P[10010] = {};
	for (int n; cin >> n&&n;) {
		memset(P, 0, sizeof(P));
		rep(i, 0, n) {
			int p, d1, d2; cin >> p >> d1 >> d2;
			P[p] = d1 + d2;
		}
		cout << max_element(P, P + 10010) - P << " " << *max_element(P, P + 10010) << endl;
	}
	return 0;
}

C++: #include<iostream>
using namespace std;
int main()
{
	int a, b, c;
	while (cin >> a,a != 0)
	{	
		int d[10000] = {}, sum[10000] = {};
		for (int i = 0; i < a; i++)
		{
			cin >> d[i] >> b >> c;
			sum[i] = b + c;
			for (int j = 0; j < 2; 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<climits>
#include<math.h>
#include<vector>
#include<algorithm>
#include<cstdio>
#include <string>
#include <complex>
#include <functional>
using namespace std;
typedef pair<int,int> P;
double dat[100][100];
int dp[6][1010];//動的計画法
int prime[1000001];
char str[1010][1010];
vector<pair<int,int> > pc[100001];
int ABS(int a){return max(a,-a);}
int main(){
    int n;
    int num,d1,d2;
    while(cin>>n,n){
        int max=0;
        int ans;
        for(int i=0;i<n;i++){
            cin>>num>>d1>>d2;    
            if(max<d1+d2){
                max=d1+d2;
                ans = num;
            }
        }
        cout << ans << " " << max << endl;
    }
    return 0;
}

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

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

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

int n;
int cnt;
int p[10000];
int d1, d2;
int p_sum[10000];
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<bits/stdc++.h>
using namespace std;

int main(){
    int n;
    while(cin>>n,n){
        pair<int,int>ma=pair<int,int>(0,0);
        while(n--){
            int p,a,b;
            cin>>p>>a>>b;
            ma=max(ma,pair<int,int>(a+b,p));
        }
        cout<<ma.second<<" "<<ma.first<<endl;
    }

    return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    while(cin>>n,n){
        int p[2],point[2]={};
        cin>>p[0]>>point[0]>>point[1];
        point[0]+=point[1];
        for(int i=0;i<n-1;i++){
            point[1]=0;
            cin>>p[1];
            for(int j=0,num;j<2;j++){
                cin>>num;
                point[1]+=num;
            }
            if(point[0]<point[1]){
                p[0]=p[1];
                point[0]=point[1];
            }
        }
        cout<<p[0]<<" "<<point[0]<<endl;
    }
}

C++: #include<iostream>
using namespace std;
int main() {
	int n;
	while (cin >> n&&n) {
		int p[10000], d1[10000], d2[10000];
		int top[2] = {};
		for (int i = 0; i < n; i++) {
			cin >> p[i] >> d1[i] >> d2[i];
			if (top[1] < d1[i] + d2[i]) {
				top[0] = p[i];
				top[1] = d1[i] + d2[i];
			}
		}
		cout << top[0] <<" "<< top[1] << endl;
	}


	return 0;
}