https://www.acmicpc.net/problem/1267
import java.util.*
import java.lang.String.format
fun main(args: Array<String>) {
val s=Scanner(System.`in`)
var n=s.nextInt()
var sy=0
var sm=0
for(i in 0 until n){
var a=s.nextInt()
sy+=(a/30+1)*10
sm+=(a/60+1)*15
}
if(sy>sm) print(format("M %d",sm))
else if(sy<sm) print(format("Y %d",sy))
else print(format("Y M %d",sy))
}