https://www.acmicpc.net/problem/1267
n=int(input()) sy=0 sm=0 a=list(map(int,input().split())) for i in range(n): sy+=(a[i]//30+1)*10 sm+=(a[i]//60+1)*15 if sy>sm: print("M %d"%sm) elif sy<sm: print("Y %d"%sy) else: print("Y M %d"%sy)