https://www.acmicpc.net/problem/1267
import java.util.*;
public class Main {
public static void main(String args[]) {
Scanner s=new Scanner(System.in);
int n=s.nextInt();
int sy=0;
int sm=0;
for(int i=0;i<n;i++){
int a=s.nextInt();
sy+=(a/30+1)*10;
sm+=(a/60+1)*15;
}
if(sy>sm) System.out.format("M %d",sm);
else if(sy<sm) System.out.format("Y %d",sy);
else System.out.format("Y M %d",sy);
}
}