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++: /*
	2400: You Are the Judge
*/
#include	<iostream>
#include	<string>
#include	<utility>
#include	<algorithm>
#include	<vector>

using namespace std;

typedef struct tms {
	short	PrStats[10];
	int		ID;
	int		AcceptC;
	int		Penalty;
	bool operator<(const tms& another) const {
		if (AcceptC != another.AcceptC) {
			return AcceptC > another.AcceptC;
		}
		if (Penalty != another.Penalty) {
			return Penalty < another.Penalty;
		}
		return ID < another.ID;
	}
} Teams_1;

int main(void) {
	while (1) {
		int		T, P, R;

		cin >> T >> P >> R;
		if (T == 0 && P == 0 && R == 0) { break; }
		vector< Teams_1 > TeamDatas(T);
		for (int i = 0; i < T; i++) {
			for (int j = 0; j < P; j++) {
				TeamDatas[i].PrStats[j] = 0;
			}
			TeamDatas[i].ID = i + 1;
			TeamDatas[i].AcceptC = 0;
			TeamDatas[i].Penalty = 0;
		}
		for (int i = 0; i < R; i++) {
			int		tID, pID, time;
			string	message;
			cin >> tID >> pID >> time >> message;
			tID--;		pID--;
			if (message == "CORRECT" && TeamDatas[tID].PrStats[pID] != -1) {
				TeamDatas[tID].AcceptC++;
				TeamDatas[tID].Penalty += TeamDatas[tID].PrStats[pID] * 1200 + time;
				TeamDatas[tID].PrStats[pID] = -1;
			}
			else {
				TeamDatas[tID].PrStats[pID]++;
			}
		}
		sort(TeamDatas.begin(), TeamDatas.end());
		for (int i = 0; i < T; i++) {
			cout << TeamDatas[i].ID << ' ' << TeamDatas[i].AcceptC << ' ' << TeamDatas[i].Penalty << endl;
		}
	}
	return 0;
}

C++: 
//http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=2400

#include<iostream>
#include<map>
#include<vector>
#include<algorithm>
#include<cmath>
#include<climits>
#include<ctime>
#include<cstring>
#include<numeric>

#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(a) (cerr << #a << "=" << (a) << endl)
#define DUMP(list) cout << "{ "; for(auto nth : list){ cout << nth << " "; } cout << "}" << endl;

using namespace std;

struct Team {
	int accept;
	int pena;
	int tID;
	
	bool operator<( const Team& right ) const {
			if(accept == right.accept)
			{
				if(pena == right.pena){
					return tID < right.tID;
				}else{
					return pena < right.pena;
				}
			}else{
				return accept > right.accept;
			}
	}
};

int main()
{
	int T,P,R;
	while(cin >> T >> P >> R)
	{
		if(T == 0 && P == 0 && R == 0){ break; }
		vector<Team> team(T);
		rep(i,T){ team[i] = {0,0,i+1}; }

		int miss[T][P];
		fill_n((int *)miss, sizeof(miss) / sizeof(int), 0);

		rep(i,R)
		{
			int tID, pID, time;
			string message;

			cin >> tID >> pID >> time >> message;

			tID--; pID--;

			if(miss[tID][pID] != -1)
			{
				if(message == "WRONG")
				{
					miss[tID][pID] += 1;
				}
				else
				{
					team[tID].accept += 1;
					team[tID].pena += miss[tID][pID]*1200 + time; 		
					miss[tID][pID] = -1;
				}
			}
		}


		sort(ALL(team));

		rep(i,T){
			cout << team[i].tID << " " << team[i].accept << " " << team[i].pena << endl;
		}
	}
	return 0;
}