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 <bits/stdc++.h>
#include <stdint.h>

typedef uint32_t u32;
typedef uint64_t u64;

class Team {
public:
  Team();
  void AC(long problem_id, long time);
  void WA(long problem_id, long time);
  long Point() const;
  long Num_AC() const;
  void Dump();
  void Setid(long id_);
  long ID() const;
private:
  long miss[16];
  bool correct[16];
  long point;
  long num_ac;
  long id;
};

Team::Team() {
  for(long i = 0; i < 16; ++i) {
    miss[i] = 0;
    correct[i] = false;
  }
  point = 0;
  num_ac = 0;
}

void Team::AC(long problem_id, long time) {
  correct[problem_id] = true;
  point += miss[problem_id] * 1200 + time;
  num_ac += 1;
}

void Team::WA(long problem_id, long time) {
  correct[problem_id] = false;
  miss[problem_id] += 1;
}

long Team::Point() const {
  return point;
}

long Team::Num_AC() const {
  return num_ac;
}

void Team::Setid(long id_) {
  id = id_;
}

long Team::ID() const {
  return id;
}

void Team::Dump() {
  std::cout << id << ' ' << Num_AC() << ' ' << point << std::endl;
}

bool operator < (const Team& left, const Team& right) {
  if( left.Num_AC() != right.Num_AC() ) return -left.Num_AC() < -right.Num_AC();
  if( left.Point() != right.Point() ) return left.Point() < right.Point();
  return left.ID() < right.ID();
}

int main() {

  for(;;) {
    long T, P, R;
    std::cin >> T >> P >> R;
    if( T == 0 and P == 0 and R == 0 ) break;
    long tID, pID, time;
    std::string message;
    Team team[64];
    for(long i = 0; i < 64; ++i) {
      team[i].Setid(i);
    }                                 
    for(long i = 0; i < R; ++i) {
      std::cin >> tID >> pID >> time;
      std::cin >> message;
      if( message == "CORRECT" ) {
        team[tID].AC(pID, time);
      }
      else {
        team[tID].WA(pID, time);
      }
    }
    std::sort(team+1, team+T+1);
    for(long i = 1; i <= T; ++i) {
      team[i].Dump();
    }
  }  
  
  return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <cstdlib>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <cstring>
#include <cctype>
#include <sstream>
#include <set>
#include <map>
#include <queue>
#include <complex>
using namespace std;
#define REP(i,n) for(int i = 0; i < (int)n; i++)
#define FOR(i,a,b) for(int i = a; i < (int)b; i++)
const int INF = 1<<28;

bool com(const pair<int, pair<int, int> >& left, const pair<int, pair<int, int> >& right) {
	if(left.second.first == right.second.first) {
		if(left.second.second == right.second.first)
			return left.first < right.first;
		else
			return left.second.second < right.second.second;
	}
	else
		return left.second.first > right.second.first;
}

int main() {
	int T, P, R;
	while(cin >> T >> P >> R, T|P|R) {
		vector< pair<int, pair<int, int> > > vp;
		multiset<int> w;
		REP(i, T)
			vp.push_back(make_pair(i+1, make_pair(0, 0)));
		REP(j, R) {
			int tid, pid, time;
			string message;
			cin >> tid >> pid >> time >> message;
			if(message == "CORRECT") {
					vp[tid-1].second.first++;
					vp[tid-1].second.second += w.count(tid * 100 + pid) * 1200 + time;
			}
			else if(message == "WRONG")
				w.insert(tid * 100 + pid);
		}
		sort(vp.begin(), vp.end(), com);
		REP(i, vp.size())
			cout << vp[i].first << ' ' << vp[i].second.first << ' ' << vp[i].second.second << endl; 
	}
	return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <functional>
#include <cstdlib>
#include <sstream>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <complex>
#include <vector>
#include <bitset>
#include <cstdio>
#include <cmath>
#include <time.h>
#include <tuple>
#define all(c) ((c).begin(),(c).end())
#define rall(c) ((c).rbegin(),(c).rend())
//#define sort(v,n) sort(v,v+n)
#define ll long long
#define fi first
#define se second
#define inf 999999999
using namespace std;
const ll MOD = 1e9 + 7;
const double PI = acos(-1.0);
//---------------------------------------------------------------------------------------------//
int t, p, r;
int main() {
	while (cin >> t >> p >> r, t) {
		int score[55];
		bool accepted[55][11];
		for (int i = 0; i < 55; i++)score[i] = 0;
		int wrong[55][11];
		for (int i = 0; i < 55; i++)
			for (int j = 0; j < 11; j++)  wrong[i][j] = 0, accepted[i][j] = 0;
		for (int i = 0; i < r; i++) {
			int tid, pid, time;
			string a;
			cin >> tid >> pid >> time >> a;
			tid--; pid--;
			if (accepted[tid][pid] == 1)continue;
			if (a[0] == 'W') {
				wrong[tid][pid]++;
			}
			else {
				score[tid] += time + wrong[tid][pid] * 1200;
				accepted[tid][pid] = 1;
			}
		}
		vector < pair <pair <int, int>, int >> vpp;
		for (int i = 0; i < t; i++) {
			int cont = 0;
			for (int j = 0; j < p; j++) {
				if (accepted[i][j])cont++;
			}
			vpp.push_back( pair<pair<int,int>,int>(pair<int,int>(cont,-score[i]),-i-1));
		}
		sort(vpp.begin(), vpp.end());
		for (int i = t-1; i >=0; i--) {
			cout << -vpp[i].second << " " << vpp[i].first.first << " " << -vpp[i].first.second << endl;
		}
	}
	return 0;
}