In the game of Tetris, there are seven types of pieces — tetrominoes. We will denote them by the letters I, J, L, O, S, Z, and T. During the game, pieces appear one by one, and their order depends on the generation algorithm. In one of the most popular algorithms, the sequence of appearing pieces is divided into blocks of 7 tetrominoes, and all pieces in each block are distinct. For example, the beginning of the sequence may look like this:
IJLOSZT TISLZJO JLITOZS ...
Here, the blocks of 7 pieces are separated by spaces. In Tetris versions with such an algorithm, openers appeared — prearranged setups at the beginning of the game that give a lot of points. Only a few openers can be used for any piece order. Almost every opener has restrictions on the order in which pieces appear within the blocks. At the start of the game, the player sees the next 7 pieces and can determine which opener they should use. Consider several openers:
-
SINGLE DOUBLE PERFECT CLEAR — can be used if O appears before at least one of the pieces S, Z, or T.
-
SINGLE TRIPLE SINGLE — can be used if at least one of the following conditions holds:
-
S appears before J
-
Z appears before L
-
J appears before S and S appears before T
-
L appears before Z and Z appears before T
-
TRIPLE TRIPLE PERFECT CLEAR — can be used if S appears before O or Z appears before O.
For example, if the first 7 pieces appear in the order LZSIOJT, then SINGLE DOUBLE PERFECT CLEAR can be used, since O appears before T. In the case of LZSITJO, the piece O appears after S, Z, and T, so SINGLE DOUBLE PERFECT CLEAR cannot be used. Interestingly, for any order of the first 7 pieces, at least one of the three listed openers is suitable. Based on the order in which the first 7 pieces appear, determine any opener that can be used.
Input
The only line contains 7 distinct characters — the piece labels in the order they appear. Each of the characters I, J, L, O, S, Z, and T appears exactly once in the string.
Output
In the only line, print the name of any opener that can be used. That is, print one of the following strings:
-
SINGLE DOUBLE PERFECT CLEAR
-
SINGLE TRIPLE SINGLE
-
TRIPLE TRIPLE PERFECT CLEAR
If several openers can be used, print any of them.
Sample
| input | output |
|---|
LZSIOJT
| SINGLE DOUBLE PERFECT CLEAR
|
Problem Author: Timofey Imaev
Problem Source: The 2026 ICPC Ural Qualification