Jean and Joe are an untidy couple who share a similar taste in clothes. Their two children, Jane and James, dress in the same style.
Jean's mother came to stay and was horrified by the untidy state of the house. Judging only by the size printed on each item, she sorted every piece of clothing into a separate pile for each of the four people. Sometimes the size had been cut off or was unreadable, so those items went into a separate "unknown" pile.
Classify each item with these rules:
M or L, it belongs to Joe.S, it belongs to James.Jean's mother visits often and must repeat this every time. Write a program that does the sorting for her.
The input describes several visits.
For each visit, the first line contains an integer $N$ ($0 < N \le 50$), the number of clothing items found around the house. Each of the next $N$ lines gives the size of one item: a 1- or 2-digit number, or one of the letters S, M, or L, or the letter X if the size is missing or unreadable.
The input ends with a line containing $N = 0$, which must not be processed.
For each visit, print one line with five integers separated by single spaces: the number of items belonging to Joe, Jean, Jane, and James, in that order, followed by the number of items that could not be assigned to anyone. Print 0 for any empty pile.