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<map>
#include<vector>
#include<algorithm>
#include<cmath>
#include<climits>
#include<ctime>
#include<cstring>
#include<stack>
#include<queue>
#include<sstream>
#include<string>

#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define DUMP(list) cout << "{ "; for(auto nth : list){ cout << nth << " "; } cout << "}" << endl;


using namespace std;

struct Team{
  int t_num;
  int t_correct;
  int t_time;
  int t_wrong[11];
  Team(int n,int p){
    t_num=n;
    t_correct=0;
    t_time=0;
    rep(i,p) t_wrong[i]=0;
  }
};

//構造体ソート
class sort_type1{
  public:
    bool operator()(const Team& a,const Team& b){
      
      if(a.t_correct!=b.t_correct) return a.t_correct > b.t_correct;
      
      if(a.t_time != b.t_time) return a.t_time < b.t_time;

      return a.t_num < b.t_num;
    }
};

int main(){
  
  while(1){
    int T,P,R;
    cin >> T >> P >> R;
    
    if(T==0&&P==0&&R==0) break;
    
    vector<Team> list;
    rep(i,T){
      Team tmp(i,P);
      list.push_back(tmp);
    }
    
    rep(i,R){
      int t,p,time;
      string str;
      cin >> t >> p >> time >> str;
      t--;p--;
      if(str=="WRONG"){
        list[t].t_wrong[p]++;
       // cout << "WRONG" << endl;
      }else if(str=="CORRECT"){
        
        list[t].t_time+=(1200*list[t].t_wrong[p]);
        list[t].t_time+=time;
        list[t].t_correct++;
      }
   }

    sort(list.begin(),list.end(),sort_type1());
    rep(i,list.size()){
      cout << list[i].t_num + 1 << " " << list[i].t_correct << " " <<list[i].t_time << endl;
    }
  }


}

C++: //include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <fstream>
#include <complex>
#include <math.h>

using namespace std;

//conversion
//------------------------------------------
inline long toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
inline long toLong(string s) {long v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<long, long> PLL;
typedef long long LL;
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

const long double EPS = 1e-12;
const int INF = 10000;

int wrong[51][11];
PLL cnt_pena[51];



int main(){
	int T,P,R;
	while(cin>>T>>P>>R){
		if(T==0&&P==0&&R==0)break;
		CLR(wrong);CLR(cnt_pena);
		REP(i,R){
			int tid,pid,time;
			string mg;
			cin>>tid>>pid>>time>>mg;
			if(mg=="CORRECT"){
				cnt_pena[tid].first--;
				cnt_pena[tid].second+=wrong[tid][pid]*1200+time;
				
			}else{
				wrong[tid][pid]++;
			}
		}
		vector<pair< PLL, int> >pi;
		REP(i,T)pi.PB(MP(cnt_pena[i+1],i+1));
		SORT(pi);
		REP(i,T)cout<<pi[i].second<<" "<<-pi[i].first.first<<" "<<pi[i].first.second<<endl;
	}
}

C++: #include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<string>
#include<sstream>
#include<cmath>
#include<numeric>
#include<map>
#include<stack>
#include<queue>
#include<cassert>
using namespace std;
int inf = 1000000000;

bool comp(vector<int> l, vector<int> r){
  if( l[0] != r[0] ) return l[0] > r[0];
  if( l[1] != r[1] ) return l[1] < r[1];
  return l[2] < r[2];
}

int main(void) {

  int t, p, r;
  while(cin >> t >> p >> r){
    if( t == 0 && p == 0 && r == 0 ) break;
    vector< vector<int> > team(t, vector<int> (3));
    for(int i=0; i<t; i++) team[i][2] = i+1;
    vector< vector<int> > pe(t, vector<int>(p, 0));

    int tID, pID, ti;
    string m;
    for(int i=0; i<r; i++){
      cin >> tID >> pID >> ti >> m;
      tID--;
      pID--;
      if( m == "WRONG" ) pe[tID][pID]++;
      else{
        team[tID][0]++;
        team[tID][1] += pe[tID][pID] * 1200 + ti;
        pe[tID][pID] = -1;
      }
    }
    sort(team.begin(), team.end(), comp);

    for(int i=0; i<t; i++){
      cout << team[i][2] << " " << team[i][0] << " " << team[i][1] << endl;
    }

  }


  return 0;
}


// EOF