https://www.acmicpc.net/problem/1267
using System;
class Program
{
static void Main() {
int n=int.Parse(Console.ReadLine());
int sy=0;
int sm=0;
string[] s=Console.ReadLine().Split(' ');
for(int i=0;i<n;i++){
int a=int.Parse(s[i]);
sy+=(a/30+1)*10;
sm+=(a/60+1)*15;
}
if(sy>sm) Console.Write("M {0}",sm);
else if(sy<sm) Console.Write("Y {0}",sy);
else Console.Write("Y M {0}",sy);
}
}