public void solve() throws IOException {
    int n = nextInt();
    Problem[] problems = new Problem[9];
    for (int x = 0; x < 9; x++) {
      problems[x] = new Problem((char) (x + 65));
    }

    for (int x = 0; x < n; x++) {
      int time = nextInt();
      String team = nextToken();
      String probid = nextToken();
      String result = nextToken();

      Problem problem = problems[probid.charAt(0) - 65];
      if (problem.solved.get(team) == null) {
        Integer numsubs = problem.submissions.get(team);
        if (numsubs == null) {
          problem.submissions.put(team, 1);
        } else {
          problem.submissions.put(team, numsubs + 1);
        }

        if (result.equals("A")) {
          problem.accepted++;
          problem.solved.put(team, time);
        }
      }
    }

    for (int x = 0; x < 9; x++) {
      Problem problem = problems[x];
      System.out.print(problem.id + " ");
      System.out.print(problem.accepted);
      if (problem.accepted > 0) {
        System.out.print(" " + problem.getAvgSubmissions());
        System.out.print(" " + problem.getAvgTime());
      }
      System.out.println();
    }

  }