Go: // You Are the Judge(審判は君だ！)
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=2400&lang=jp
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

type Team struct {
	TID         int
	Accepted    int
	WrongAnswer map[int]int
	Penalty     int
}

type Teams []Team

func (t Teams) Len() int      { return len(t) }
func (t Teams) Swap(i, j int) { t[i], t[j] = t[j], t[i] }
func (t Teams) Less(i, j int) bool {
	// より多くの問題を解いたチームは順位が上になる
	if t[i].Accepted > t[j].Accepted {
		return true
	} else if t[i].Accepted == t[j].Accepted {
		// 解いた問題が同じ場合、ペナルティの少ないチームのほうが順位が上になる
		if t[i].Penalty < t[j].Penalty {
			return true
		} else if t[i].Penalty == t[j].Penalty {
			// 解いた問題もペナルティも同じ場合、チーム番号が小さいほうのチームが順位が上になる
			if t[i].TID < t[j].TID {
				return true
			}
		}
	}
	return false
}

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)

	for {
		t, p, r := nextInt(sc), nextInt(sc), nextInt(sc)
		if t == 0 && p == 0 && r == 0 {
			break
		}

		teams := []Team{}
		for tID := 0; tID < t; tID++ {
			teams = append(teams, Team{tID + 1, 0, map[int]int{}, 0})
		}

		for i := 0; i < r; i++ {
			tID, pID, time, message := nextInt(sc), nextInt(sc), nextInt(sc), nextString(sc)
			tID--

			if message == "CORRECT" {
				teams[tID].Accepted++
				wa, _ := teams[tID].WrongAnswer[pID]
				teams[tID].Penalty += wa*1200 + time
			} else {
				teams[tID].WrongAnswer[pID]++
			}
		}

		sort.Sort(Teams(teams))

		for _, team := range teams {
			fmt.Println(team.TID, team.Accepted, team.Penalty)
		}
	}
}

func nextInt(sc *bufio.Scanner) int {
	sc.Scan()
	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return i
}

func nextString(sc *bufio.Scanner) string {
	sc.Scan()
	return sc.Text()
}

C++: #include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<vector>
#include<cmath>
#include<cstdio>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define it ::iterator
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double ESP=1e-10;
using namespace std;
int main(){
  int a,b,c;
  while(cin>>a>>b>>c,a||b||c){
    vector<map<int,int> >in(a+1);
    vector<int>out(a+1);
    vector<int>co(a+1);
    rep(i,c){
      int d,e,f;string s;
      cin>>d>>e>>f>>s;
      if(s[0]=='W')in[d][e]++;
      else{
	co[d]++;
	out[d]+=in[d][e]*1200+f;
      }
    }
    int to=0;
    rep(i,a)to=max(to,out[i+1]);
    to++;
    //rep(i,a)cout<<out[i+1]<<endl;
    rep(i,a){
      int maxi=0;
      int co1=0;
      rep(j,a)if(to>out[j+1])maxi=max(maxi,out[j+1]);
      rep(j,a)if(maxi==out[j+1]){
	cout<<j+1<<" "<<co[j+1]<<" "<<out[j+1]<<endl;
	co1++;
      }
      to=maxi;
      i+=co1-1;
    }
  }
}

C++: #pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC push_options
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx")
#include<bits/stdc++.h>
#include <xmmintrin.h>
#include <immintrin.h>
using namespace::std;
__attribute__((constructor))void init(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/priority_queue.hpp>
#include<ext/pb_ds/tag_and_trait.hpp>
// #include <boost/multiprecision/cpp_dec_float.hpp>
// #include <boost/multiprecision/cpp_int.hpp>
// namespace mp = boost::multiprecision;
// typedef mp::number<mp::cpp_dec_float<0>> cdouble;
// typedef mp::cpp_int cint;
template<typename T>using pbds=__gnu_pbds::tree<T,__gnu_pbds::null_type,less<T>,__gnu_pbds::rb_tree_tag,__gnu_pbds::tree_order_statistics_node_update>;
template<typename T>using pbds_map=__gnu_pbds::tree<T,T,less<T>,__gnu_pbds::rb_tree_tag,__gnu_pbds::tree_order_statistics_node_update>;
template<typename T,typename E>using hash_map=__gnu_pbds::gp_hash_table<T,E>;
template<typename T>using pqueue =__gnu_pbds::priority_queue<T, greater<T>,__gnu_pbds::rc_binomial_heap_tag>;
typedef long long lint;
#define INF (1LL<<60)
#define IINF (1<<30)
#define EPS (1e-10)
#define endl ('\n')
#define MOD 1000000007LL
//#define MOD 998244353LL
typedef vector<lint> vec;
typedef vector<vector<lint>> mat;
typedef vector<vector<vector<lint>>> mat3;
typedef vector<string> svec;
typedef vector<vector<string>> smat;
template<typename T>inline void numout(T t){bool f=0;for(auto i:t){cout<<(f?" ":"")<<i<INF/2?i:"INF";f=1;}cout<<endl;}
template<typename T>inline void numout2(T t){for(auto i:t)numout(i);}
template<typename T>inline void output(T t){bool f=0;for(auto i:t){cout<<(f?" ":"")<<i;f=1;}cout<<endl;}
template<typename T>inline void output2(T t){for(auto i:t)output(i);}
template<typename T>inline void _output(T t){bool f=0;for(lint i=0;i<t.size();i++){cout<<f?"":" "<<t[i];f=1;}cout<<endl;}
template<typename T>inline void _output2(T t){for(lint i=0;i<t.size();i++)output(t[i]);}
#define rep(i,n) for(lint i=0;i<lint(n);++i)
#define repi(i,a,b) for(lint i=lint(a);i<(lint)(b);++i)
#define rrep(i,n) for(lint i=lint(n)-1;i>=0;--i)
#define rrepi(i,a,b) for(lint i=lint(b)-1;i>=lint(a);--i)
#define irep(i) for(lint i=0;;++i)
#define all(n) begin(n),end(n)
#define dist(a,b,c,d) sqrt(pow(a-c,2)+pow(b-d,2))
inline lint gcd(lint A,lint B){return B?gcd(B,A%B):A;}
inline lint lcm(lint A,lint B){return A/gcd(A,B)*B;}
// inline cint cgcd(cint A,cint B){return B?cgcd(B,A%B):A;}
// inline cint clcm(cint A,cint B){return A/cgcd(A,B)*B;}
bool chmin(auto& s,const auto& t){bool res=s>t;s=min(s,t);return res;}
bool chmax(auto& s,const auto& t){bool res=s<t;s=max(s,t);return res;}
const vector<lint> dx={1,0,-1,0,1,1,-1,-1};
const vector<lint> dy={0,1,0,-1,1,-1,1,-1};
#define SUM(v) accumulate(all(v),0LL)
auto call=[](auto f,auto... args){return f(f,args...);};

int main(){
    while(1){
        lint t,p,r;
        cin>>t>>p>>r;
        if(t==0)break;
        vector<lint>ans(t,0);
        vector<lint>ans2(t,0);
        mat v(t,vec(p,0));
        rep(i,r){
            lint a,b,c;
            string s;
            cin>>a>>b>>c>>s;
            a--;b--;
            if(v[a][b]<0)continue;
            if(s=="WRONG"){
                v[a][b]++;
            }else{
                ans[a]+=v[a][b]*1200+c;
                ans2[a]++;
                v[a][b]=-1;
            }
        }
        vector<lint>ans3(t,0);
        rep(i,t)ans3[i]=i;
        sort(all(ans3),[&](auto s,auto t){return make_tuple(-ans2[s],ans[s],s)<make_tuple(-ans2[t],ans[t],t);});
        rep(i,t){
            cout<<ans3[i]+1<<" "<<ans2[ans3[i]]<<" "<<ans[ans3[i]]<<endl;
        }
    }
}

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

class info{
public:
	int id,penalty,num;
	info(int id,int penalty,int num):id(id),penalty(penalty),num(num){}
};

bool operator < (info a,info b){
	if(a.num!=b.num) return a.num>b.num;
	if(a.penalty!=b.penalty) return a.penalty<b.penalty;
	return a.id<b.id;
}


int main()
{
	int T,P,R;
	while(cin>>T>>P>>R && T!=0){
		vector<vector<bool> > done(T,vector<bool>(P,false));
		vector<vector<int> >  num_wrong(T,vector<int>(P,0));
		vector<int> num_correct(T,0);
		vector<int> penalty(T,0);

		for(int i=0;i<R;i++){
			int team,problem,time;
			string s;
			cin>>team>>problem>>time>>s;
			problem--;team--;
			if(s=="WRONG"){
				num_wrong[team][problem]++;
			}
			else{
				num_correct[team]++;
				penalty[team]+=num_wrong[team][problem]*1200+time;
			}
		}
		vector<info> work;
		for(int i=0;i<T;i++){
			work.push_back(info(i,penalty[i],num_correct[i]));
		}
		sort(work.begin(),work.end());
		for(int i=0;i<T;i++)
			cout<<work[i].id+1<<" "<<work[i].num<<" "<<work[i].penalty<<endl;
	}
}