This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
#define sp << " " << 
#define int long long
#define vi vector<int>
#define pb push_back
#define F(xxx,yyy) for (int xxx=1;xxx<=yyy;xxx++)
const int N = 4e5+1;
void solve() {
	int q;
	cin >> q;
	int a = 0,b = 0,c = 0;
	while (q--) {
		string s,t;
		cin >> s >> t;
		if (s == "section") {
			b = 0,c = 0;
			cout << ++a sp t << endl;
		}
		else if (s == "subsection") {
			c = 0;
			cout << a << '.' << ++b sp t << endl;
		}
		else {
			cout << a << '.' << b << '.' << ++c sp t << endl;
		}
		
	}
}    
 
 
 
                                
signed main() { 
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int t = 1;
    //cin >> t; 
    while (t --> 0) solve();
}
 
 
 
| # | 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... |