# Subdomain Visit Count

medium

1. A website domain like "www.pepcoding.com" consists of various subdomains like "com" at the topmost level, "pepcoding.com" at the next level, and "www.pepcoding.com" at the lowest level. 2. When you visit a domain like "www.pepcoding.com", you will also visit its parent domains "pepcoding.com" and "com". 3. You are given N number of strings where every string contains a number and a domain separated by a space, where the number represents the visit count of the domain. 4. You have to find the number of visits for each sub-domain.

## Constraints

1 <= N <= 100 1 <= visit count of a domain <= 10^4 1 <= length of domain name <= 100 Each address will contain at most 2 "." characters.

## Format

### Input

A number N N strings. Each string contains a number and domain.

### Output

Every line of output contains a number and a sub-domain, where the number represents the visit count of the sub-domain.

## Example

Sample Input

1
9999 www.pepcoding.com

### Sample Output

9999 com
9999 pepcoding.com
9999 www.pepcoding.com