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<sstream>
#include<algorithm>
#include<climits>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<ctime>
#include<cfloat>
#include<functional>
#include<map>
#include<string>
#include<cstring>
#include<vector>
#include<queue>
#include<stack>
#include<deque>
#include<set>
#include<bitset>
#include<list>
#include<numeric>
#include<complex>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<long long, int> ll_i;
typedef pair<double, int> d_i;
typedef pair<long long, long long> ll_ll;
typedef pair<double, double> d_d;
typedef vector<int> Vint;

#define PI 3.141592653589793238462643383279
#define mod 1000000007LL
#define rep(i, n) for(i = 0;i < n;++i)
#define rep1(i, n) for(i = 1;i < n;++i)
#define rep2d(i, j, n) for(i = 0;i < n;++i)for(j = i + 1;j < n;++j)
#define per(i, n) for(i = n - 1;i > -1;--i)
#define int(x) int x; scanf("%d",&x)
#define int2(x, y) int x, y; scanf("%d%d",&x, &y)
#define int3(x, y, z) int x, y, z; scanf("%d%d%d",&x, &y, &z)
#define scn(n, a) rep(i, n)cin >> a[i]
#define sc2n(n, a, b) rep(i, n)cin >> a[i] >> b[i]
#define pri(x) cout << x << "\n"
#define pri2(x, y) cout << x << " " << y << "\n"
#define pri3(x, y, z) cout << x << " " << y << " " << z << "\n"
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define endl "\n"
#define kabe puts("---------------------------")
#define kara puts("")
#define debug(x) cout << " --- " << x << "\n"
#define debug2(x, y) cout << " --- " << x << " " << y << "\n"
#define debug3(x, y, z) cout << " --- " << x << " " << y << " " << z << "\n"
#define X first
#define Y second
#define eps 0.0001
#define prid(x) printf("%.15lf\n", x)

struct result{
  int id, ac, time;
  Vint pena;
  void use(int n){ pena.assign(n, 0); return; }
};

bool myc(result a, result b){
  if(a.ac == b.ac && a.time == b.time)return a.id < b.id;
  if(a.ac == b.ac)return a.time < b.time;
  return a.ac > b.ac;
}

signed main(void){
  int i, j, k;
  for(int testcase = 0;testcase < 1234567;testcase++){
    int3(t, p, r);
    if((t | p | r) == 0)break;

    vector<result> team;
    team.resize(t);
    rep(i, t){
      team[i].use(p); team[i].id = i + 1;
    }

    for(;r--;){
      int3(x, y, z);
      x--; y--;
      string s; cin >> s;
      if(s == "WRONG")team[x].pena[y]++;
      else{
        team[x].ac++;
        team[x].time += z + team[x].pena[y] * 1200;
      }
    }

    sort(all(team), myc);
    rep(i, t)pri3(team[i].id, team[i].ac, team[i].time);


//*/

//*/ break;
  }
  return 0;
}

C++: #include<iostream>
#include<string>
#include<cstring>
#include<algorithm>
#define I (1<<21)
using namespace std;
int x[100], z[100], y[99][20], h[100], a, b, c, d, e, f, i, j, k; string S;
int main() {
	while (true) {
		for (i = 0; i < 100; i++) { x[i] = I;}
		memset(y, 0, sizeof(y));
		memset(h, 0, sizeof(h));
		cin >> a >> b >> c;
		if (a == 0) { break; }
		for (i = 0; i < c; i++) {
			cin >> d >> e >> f >> S;
			if (S[0] == 'W') {
				y[d][e] ++;
			}
			else {
				x[d] += I;
				x[d] -= f + 1200 * y[d][e];
			}
		}
		for (i = 1; i <= a; i++) { z[i] = x[i]; }
		sort(x + 1, x + a + 1);
		for (i = a; i >= 1; i--) {
			for (j = 1; j <= a; j++) {
				if (z[j] == x[i] && h[j]==0) {
					cout << j << ' ' << x[i] / I << ' ' << (100 * I - x[i]) % I << endl;
					h[j] = 1;
				}
			}
		}
	}
}

C++: #include <vector>
#include <iostream>
#include <utility>
#include <algorithm>
#include <string>
#include <deque>
#include <tuple>
#include <queue>
#include <functional>
#include <cmath>
#include <iomanip>
#include <map>
#include <numeric>
#include <unordered_map>
#include <unordered_set>
//cin.sync_with_stdio(false);
//streambuf
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<double, double> pdd;
using vi = vector<int>;
using vpii = vector<pii>;
template<class T, class T2> using umap = unordered_map<T, T2>;
template<class T> using uset = unordered_set<T>;
#define ALL(a) a.begin(),a.end()
#define rep(i,a) for(int i=0;i<a;i++)
#define rep1(i,a) for(int i=1;i<=a;i++)
int main() {
	int t, p, r;
	while (cin >> t >> p >> r, t) {
		vector<tuple<int, int, int, vi>> buf(t, make_tuple(0, 0, 0, vi(p + 1)));//-ac,pena,team
		rep(i, t) {
			get<2>(buf[i]) = i + 1;
		}
		rep(j, r) {
			int t, p, time;
			string mes;
			cin >> t >> p >> time >> mes;
			t--;
			get<3>(buf[t])[p] +=(mes[0]=='W'?1200:time);
			if (mes[0] == 'C') {
				get<0>(buf[t])--;
				get<1>(buf[t]) += get<3>(buf[t])[p];
			}
		}
		sort(ALL(buf));
		for (auto &a : buf) {
			cout << get<2>(a) <<' '<< -get<0>(a) <<' '<< get<1>(a) << endl;
		}
	}
}

C++: #include <bits/stdc++.h>
using namespace std;
int main(){
	int t,q,n;
	while(cin>>t>>q>>n,t){
		pair<pair<int,int > ,int >a[50];
		int c[50][10]={0};
		for(int i=0;i<50;i++)a[i].second=i+1;
		while(n--){
			int a1,a2,a3;
			string s;
			cin>>a1>>a2>>a3>>s;
			if(s[0]=='W'){
			c[a1-1][a2-1]++;
			}
			else{
				a[a1-1].first.first--;
				a[a1-1].first.second+=1200*c[a1-1][a2-1]+a3;
			}
		}
		sort(a,a+t);
		for(int i=0;i<t;i++){
			cout<<a[i].second<<' ';
			cout<<-a[i].first.first<<' ';
			cout<<a[i].first.second<<endl;
		}
	}
}

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

using namespace std;

class Team{
public:
  int tid,correct,penalty;
  map<int,int> wrongs;
  set<int> solved;
  bool operator<(const Team &a)const{
    if(correct!=a.correct) return correct>a.correct;
    else if(penalty!=a.penalty) return penalty<a.penalty;
    else return tid<a.tid;
  }
};

int main(void){
  int t,p,r;
  while(cin>>t>>p>>r,t||p||r){
    vector<Team> teams(t);
    for(int i=0;i<t;++i)teams[i].tid=i+1;
    for(int i=0,tid,pid,time;i<r;++i){
      string message;
      cin>>tid>>pid>>time>>message;
      if(teams[tid-1].solved.count(pid-1))continue;
      if(message=="CORRECT"){
        ++teams[tid-1].correct;
        teams[tid-1].penalty+=teams[tid-1].wrongs[pid-1]*1200+time;
      }else ++teams[tid-1].wrongs[pid-1];
    }
    sort(teams.begin(),teams.end());
    for(int i=0;i<t;++i)cout<<teams[i].tid<<" "<<teams[i].correct<<" "<<teams[i].penalty<<endl;
  }
  return 0;
}