P7964 [COCI 2021/2022 #2] Kaučuk

Description

The Kaučuk program has only the following three commands: - $\texttt{section}$: Create a new level-1 heading, numbered starting from $1$. - $\texttt{subsection}$: Create a new level-2 heading, numbered starting from $1$ under each level-1 heading. - $\texttt{subsubsection}$: Create a new level-3 heading, numbered starting from $1$ under each level-2 heading. Given $n$ commands and heading names, output the numbering of all headings and their names.

Input Format

The first line contains a positive integer $n$, indicating the number of commands. The next $n$ lines each contain a command name (one of $\texttt{section}$, $\texttt{subsection}$, $\texttt{subsubsection}$) and a heading name. The heading name consists of at most $20$ lowercase English letters.

Output Format

Output $n$ lines in total, representing the numbering of all headings and their names.

Explanation/Hint

**Constraints** **This problem uses bundled subtasks.** - Subtask 1 (10 pts): $1 \le n \le 3$. - Subtask 2 (10 pts): Only $\texttt{section}$ commands. - Subtask 3 (10 pts): Only $\texttt{section}$ and $\texttt{subsection}$ commands. - Subtask 4 (20 pts): No special restrictions. For $100\%$ of the data, $n \le 100$. **Hints and Notes** **This problem is translated from [COCI 2021-2022](https://hsin.hr/coci/) [CONTEST #2](https://hsin.hr/coci/contest2_tasks.pdf) _Task 1 Kaučuk_.** **The score of this problem follows the original COCI setting, with a full score of $50$.** Translated by ChatGPT 5