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() {
	int n;
	while (cin >> n&&n != 0) {
		int a, b=-1;
		for (int i = 0; i < n; i++) {
			int c, d, e;
			cin >> c >> d >> e;
			d += e;
			if (d > b) {
				a = c;
				b = d;
			}
		}
		cout << a << " " << b << endl;
	}
}

C++: #include <iostream>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)

char get(int a,int b,int c){
	if(a==100||b==100||c==100 || a+b>=180 || a+b+c >= 240)return 'A';
	if(a+b+c>=210 || (a+b+c>=150&&(a>=80||b>=80)))return 'B';
	return 'C';
}
int main(){
	int n;
	while(cin >> n , n){
		rep(i,n){
			int a,b,c;
			cin >> a >> b >> c;
			cout << get(a,b,c) << endl;
		}
	}
}

C++: #include<iostream>

using namespace std;

int main () {

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

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

			if(max_d<=d1+d2){
				max_d=d1+d2;
				max_p=p;
		}
	}
		cout<<max_p<<" "<<max_d;
	}
	
	return 0;
}

C++: #include <map>
#include <set>
#include <list>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <numeric>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <functional>

#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define repi(i,a,b) for(int i = (a); i < (b); i++)

using namespace std;

typedef    long long          ll;
typedef    unsigned long long ull;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      pii;

const int INF=1<<29;
const double EPS=1e-9;

const int dx[]={1,0,-1,0},dy[]={0,-1,0,1};

int main(){
	int n;
	while(cin>>n,n){
		priority_queue<pii> data;
		for(int i =0;i < n;i++){
			int p,d1,d2;
			cin>>p>>d1>>d2;
			data.push(pii(d1+d2,p));
		}
		cout <<data.top().second<<" "<<data.top().first<<endl;
		//cout <<data.size()<<endl;
	}
	return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <string>
#include <sstream>
#include <algorithm>
#include <math.h>
#include <map>
#include <iomanip>
#include <vector>
#include <queue>
#include <set>

#define PI 3.14159265359

#define INF 99999999;

#define rep(i, n) for(int i=0; i<n; i++)
#define REP(n) rep(i, n)

typedef long long ll;

using namespace std;



/*
class LightSwitchingPuzzle
{
public:
	int minFlips(string s)
	{

	}
}
*/


int main()
{
	int n, p, d1, d2, max_p, max_d;
	
	while (cin >> n, n)
	{
		max_d = 0;
		
		REP(n)
		{
			cin >> p >> d1 >> d2;
			if (d1 + d2 > max_d)
			{
				max_d = d1 + d2;
				max_p = p;
			}
		}
		
		cout << max_p << " " << max_d << 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 <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][1] + p[i][2]){
                ans[0] = p[i][0];
                ans[1] = p[i][1] + p[i][2];
            }
        }
    }
    cout << ans[0] << " " <<  ans[1] << endl;

    }
}

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

using namespace std;

struct DATA{
  int number;
  int distance;
};

bool Compare(const DATA&, const DATA&);

int main(){
  int i, n, p, d1, d2, d;
  DATA person;
  vector<DATA> data;

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

    for(i=0; i<n; ++i){
      cin >> p >> d1 >> d2;
      d = d1 + d2;
      person.number = p;
      person.distance = d;
      data.push_back(person);
    }

    sort(data.begin(), data.end(), Compare);

    cout << data[0].number << " " << data[0].distance << endl;
    data.clear();
  }

  return 0;
}

bool Compare(const DATA& x, const DATA& y){
  return x.distance > y.distance;
}

C++: #include<iostream>
using namespace std;
int main(){
	int n,p,d1,d2,maxp,maxv;
	while(1){
		cin >> n;
		if(n == 0) break;
		maxp = maxv = 0;
		while(n --){
			cin >> p >> d1 >> d2;
			if(maxv < d1+d2){
				maxp = p;
				maxv = d1+d2;
                                }
		}
		cout<< maxp << maxv;
	}
}

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

int main()
{
	int n;
	while(cin >> n, n)
	{
		int p,d1,d2;
		int maxp,maxd=-1;
		while(n--)
		{
			cin >> p >> d1 >> d2;
			if(maxd < d1+d2)
			{
				maxp = p;
				maxd = d1+d2;
			}
		}

		cout << maxp << " " << maxd << endl;
	}
}

C++: #include<stdio.h>
int main()
{
	int n,p,d1,d2,i,m,a;
	while(1){
		scanf("%d",&n);
		if(n==0){
			break;
		}
		m=0;
		for(i=0;i<n;i++){
			scanf("%d%d%d",&p,&d1,&d2);
			if(d1+d2>m){
				a=p;
				m=d1+d2;
			}
		}
		printf("%d %d\n",a,m);
	}
	return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <functional>
#include <vector>
#include <cstdio>
#include <string>
#include <cmath>
#include <cfloat>
#include <map>
using namespace std;
int main(){

	int n;
	int b,d1,d2;
	
	while(cin>>n,n!=0){
		int max,g=0;
		for(int i=0;i<n;i++){
			cin>>b>>d1>>d2;
			if(g<d1+d2){
				g=d1+d2;
				max=b;
			}
		}
		cout<<max<<" "<<g<<endl;
	}
}

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

#define rep(i,n) for(int i=0;i<n;i++)
#define all(c) (c).begin(),(c).end()
#define mp make_pair
#define pb push_back
#define rp(i,c) rep(i,(c).size())
#define fr(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
#define dbg(x) cerr<<#x<<" = "<<(x)<<endl

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;
const int inf=1<<28;
const double INF=1e12,EPS=1e-9;

int n;

int main()
{
	while(scanf("%d",&n),n)
	{
		int p,d1,d2,mxd=-1,mxp;
		rep(i,n)
		{
			scanf("%d%d%d",&p,&d1,&d2);
			if(d1+d2>mxd)mxd=d1+d2,mxp=p;
		}
		printf("%d %d\n",mxp,mxd);
	}
	return 0;
}