AT_scpc2026_div3_g SCSC Game

Description

#### 表示言語 / / > This year, FuriosaAI officially announced mass production of RNGD, its second-generation AI accelerator. RNGD is specialized for processing language models and multimodal models, and provides powerful computing performance even with low power consumption. At SCSC, AI agents Lulu and Terra were created using RNGD chips, and SCSC had them play the SCSC game for performance testing. The SCSC game is played with a string $ S $ consisting of uppercase letters `S` and `C` that does not contain `SCSC` as a substring. Lulu and Terra take turns, with Terra going first. On each turn, the current player chooses one character from the string and removes it. If, after the removal, the string contains `SCSC` as a substring, that player wins and the other player loses. If the current player can no longer choose any character to remove, that player loses and the other player wins. Thanks to the powerful computing performance of the RNGD chips, Lulu and Terra have become able to always find optimal moves to win. Given the string $ S $ , determine which agent wins the game if both Lulu and Terra play optimally. What is a substring? A **substring** of a string is a contiguous part of the original string. For example, `bc` is a substring of `abcd`, but `ac` is not. Multiple substrings may overlap within the same string. For example, `aba` appears a total of $ 2 $ times in `ababa`.

Input Format

The input is given from Standard Input in the following format: > $ T $ $ \mathrm{case}_1 $ $ \mathrm{case}_2 $ $ \vdots $ $ \mathrm{case}_T $ Each test case is given in the following format: > $ S $

Output Format

For each test case, output `Terra` if Terra wins, and `Lulu` if Lulu wins, one per line.

Explanation/Hint

### Constraints - $ 1 \leq T \leq 10\,000 $ - $ 1 \leq |S| \leq 200\,000 $ - $ S $ consists only of uppercase letters `S` and `C`, and does not contain `SCSC` as a substring. - The sum of $ |S| $ over all test cases does not exceed $ 200\,000 $ .