#include <bits/stdc++.h>
using namespace std;
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int f = 1, s = 1, g = 1;
    int n;
    cin >> n;
    while (n--) {
        string a, b;
        cin >> a >> b;
        if (a == "section") {
            s = 1;
            cout << f++ << ' ' << b << '\n';
        }
        else if (a == "subsection") {
            g = 1;
            cout << f - 1 << "." << s++ << ' ' << b << '\n';
        }
        else {
            cout << f - 1 << "." << s - 1 << "." << g++ << ' ' << b << '\n';
        }
    }
    return 0;
}
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... |