시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 512 MB655100.000%

문제

Davor the scientist writes his papers in LaTeX. Inspired by LaTeX, he came up with Kaučuk. Kaučuk is a very simple program for preparing a piece of text for print. It allows you to number the headings of sections, subsections and subsubsections and prepare them for print.

Kaučuk has only three different commands:

  • The section command starts a new section. All sections from the input are numbered in the output with positive integers starting from 1, in the order they appear in the input (see first example).
  • The subsection command starts a new subsection. Subsections are numbered using two numbers: the number of the section which contains the subsection, and the number of the subsection within the section (see second example). In each section the subsection numbering starts again from 1 (see third example).
  • The subsubsection command starts a new subsubsection which uses three numbers: the number of the section, the number of the subsection and the number of the subsubsection within the subsection, in a manner similar to subsections within sections (see second example).

It is guaranteed that in the input, each subsection is contained in some section, and each subsubsection is contained in some subsection. Davor might be a fine scientist, but programming is not his strong suit, which is why he is asking you to help him write a program which prepares a text written in Kaučuk for print.

입력

The first line contains a positive integer n (1 ≤ n ≤ 100), the number of lines of Kaučuk commands.

The following n lines contain Davor’s Kaučuk code. Each line of code is made up from two strings of characters, separated by a single space: the type of section (section, subsection or subsubsection) and its title. Each title is made up from at most 20 lowercase letters.

출력

In n lines you should number and print the titles of the sections, subsections and subsubsections from Davor’s code.

서브태스크

번호 배점 제한
1 10

1 ≤ n ≤ 3

2 10

The Kaučuk code will contain only the section command.

3 10

The Kaučuk code will contain only the section and subsection commands.

4 20

No additional constraints.

예제 입력 1

3
section zivotinje
section boje
section voce

예제 출력 1

1 zivotinje
2 boje
3 voce

예제 입력 2

4
section zivotinje
subsection macke
subsection psi
subsubsection mops

예제 출력 2

1 zivotinje
1.1 macke
1.2 psi
1.2.1 mops

예제 입력 3

4
section zivotinje
subsection psi
section voce
subsection ananas

예제 출력 3

1 zivotinje
1.1 psi
2 voce
2.1 ananas

채점 및 기타 정보

  • 예제는 채점하지 않는다.