fun main(args: Array<String>) {

    val input1 = readLine()!!

    // N
    val numberOfQuestions = input1.split(" ")[0].toInt()
    // M
    val numberOfSubmit = input1.split(" ")[1].toInt()

    val submits = mutableListOf<Submit>()

    for (i in 1..numberOfSubmit) {
        val input2 = readLine()!!
        submits.add(
            Submit(
                input2.split(" ")[0].toInt(),
                input2.split(" ")[1]
            )
        )
    }

    var correctNum = 0
    var penaltyNum = 0

    var resultsPerQuestion: Collection<List<String>> = submits
        .groupBy({ it.questionId }, { it.result })
        .values

    for (entry: List<String> in resultsPerQuestion) {
        for ((index, value) in entry.withIndex()) {
            if (value == "AC") {
                correctNum++
                penaltyNum += index
                break
            }
        }
    }

    println("$correctNum $penaltyNum")
}

data class Submit(
    val questionId: Int,
    val result: String
)