#C5040. Final Recipient of Last Text Message

    ID: 48646 Type: Default 1000ms 256MiB

Final Recipient of Last Text Message

Final Recipient of Last Text Message

You are given an integer n and a sequence of n messages. Each message is a string that can be either a command or a text message.

A message beginning with the prefix /to is a command message that sets the current recipient to the identifier specified immediately after the prefix. Any message that does not start with /to is considered a text message. When a text message is encountered and there is an active recipient (set by the most recent valid command), the active recipient is recorded as the final recipient for that text message.

Your task is to determine the recipient identifier of the last text message for which a valid command was active. If no text message was preceded by a valid command message (i.e. a command starting with /to ), output No text message.

Formally, if we denote by current_recipient the recipient currently set by the last valid command message, and if a text message appears when current_recipient is not null, then current_recipient becomes the candidate answer. The answer is the candidate from the last text message in the sequence, or No text message if no valid text message exists.

Note: In this problem, the integer n and the messages are provided via standard input, and the answer should be printed to standard output.

Any formulas in the problem description should be written in LaTeX format. For example: $n$, and so on.

inputFormat

The input is given via standard input and consists of:

  1. An integer n on the first line, representing the number of messages.
  2. n lines follow, each line is a message string. Each message may be a command message (starting with /to ) or a text message.

Constraints:\ $1 \leq n \leq 10^5$.

outputFormat

Output a single line containing the recipient identifier of the final text message (i.e. the candidate set by the most recent valid command message that precedes a text message). If there is no such text message, output No text message.

## sample
5
/this is a sample text message
/to 3
Hello, how are you?
See you tomorrow!
/to 2
3