Tung Tung Sahur


Submit solution

Points: 1
Time limit: 1.0s
Memory limit: 256M

Author:
Problem type
Allowed languages
C++, Java, Python

Tung is hard at work helping out with the ACPC committee when he realises he messed up the simple task he was assigned. He was meant to be sorting a pile of cards into a specific order for a game, but now he can't remember what order they are in.

To make matters worse, Tung is stressing out now so he can't think clearly! He has a stack of cards in some order he forgot, and he can only take cards from the top of that deck, and place them either onto the final presentation table, or a side table. He wants them to end up in sorted order, with the biggest number on the top, on the presentation table, but he can place them into a pile on the side table and retrieve the most recently added card from the side table to place on the presentation table at any time to help him out.

Can you help Tung fix his mistakes, or will he end up losing his friends and being booted from the committee?

Input

The first line contains a single integer n (1 \leq n \leq 10^5), the number of cards in Tung's deck.

The next line contains n space-separated integers. Each card is labelled 1 through n and appears once in the input. The first inputted number represents the top of the pile (i.e., the one that can be accessed first).

Output

If you can end up with the cards in sorted order on the presentation by always either taking the top card from the input and placing it on the top of the presentation table or side table, or taking the top card from the side table and placing it on top of the presentation table, print "Tung Tung Tung" on a line. If you can't, print "Mamma Mia!"

Example

Input 1
5
4 2 1 3 5
Output 1
Tung Tung Tung

It is possible to place all the cards in sorted order on the presentation table. First, we place 4 on the side table, then we place 2 on the side table. Then, we place 1 on the presentation table. Next, we retrieve 2 from the side table onto the presentation table, and place 3 on the presentation table. Finally, we place 4 from the side table onto the presentation table and top it off with 5. The presentation table contains 1, 2, 3, 4, 5 with 5 at the top so we were successful.

Input 2
5
1 3 4 2 5
Output 2
Mamma Mia!

In this case, it is impossible to get sorted order on the presentation table. We can place 1 onto the presentation table, and 3 and 4 onto the side table. Then, we can place 2 onto the presentaion table. However, the next required card is 3, and the cards at the top of the input and side table stacks are 4 and 5, so we cannot proceed.


Comments

There are no comments at the moment.