// 1
begin
writeln('M':3);
writeln('MMM':4);
writeln('MMMMM');
writeln('M M':4);
writeln('MMM':4);
end.
// 2
begin
writeln('M');
writeln('MM');
writeln('MMMMMM');
writeln('MM':6);
writeln('M':6);
end.
//3
begin
writeln('M','M':6);
writeln('M':2,'M':4);
writeln('MMMMM':6);
writeln('M M M':6);
writeln('MMMMM':6);
end.
//4
begin
writeln('M':7);
writeln('MM':7);
writeln('MMM':7);
writeln('MMMMM':7);
writeln('MMMMMMM');
end.
//5
begin
writeln('M','M':4);
writeln('MM','MM':3);
writeln('MMMMM');
writeln('MM','MM':3);
writeln('M','M':4);
end.