A string is said to be an SM string if it matches one of the following rules:
(1) An empty string is an SM string.
(2) If strings S1 and S2 are both SM strings, then S1S2 is an SM string.
(3) If a string S is an SM string, then {S}, [S], (S) and <S> are SM strings.
(4) If a string S is an SM string, then "sm"S is an SM string.
Given a string consisting of parentheses and "sm", determine if it is an SM string.
The input consists of several lines.
Each line contains a string S (1 <= |S| <= 10^6 ), where S consists of only '{', '}', '[', ']', '(', ')', '<', '>' and "sm".
Testcases 1-2: without "sm".
Testcases 3-5: with "sm".
For each string S, output "SM" if it is an SM string, "MS" if not.
There should be a '\n' in the end of each line.