您当前处于兼容模式。某些功能在此模式下不可用。我们强烈建议在现代浏览器上切换为标准模式以获得更好的体验。 标准模式 隐藏

#t269. 合影效果

合影效果

Group Photo

Problem Background

Special for beginners, ^_^

Problem Description

Xiaoyun and her friends went climbing Xiangshan (Fragrant Hills) and were so enchanted by the beautiful scenery that they wanted a group photo. If they stand in a single row, the boys should all be on the left (from the photographer's point of view), sorted from shortest to tallest left to right; the girls should all be on the right, sorted from tallest to shortest left to right. What will the photo look like (all heights are different)?

Input Format

The first line is the number of people nn (2≤n≤402 \le n \le 40, and there is at least one boy and one girl).

The following nn lines each contain a person's gender (male or female) and height (a floating-point number, in metres), separated by a space.

Output Format

Output nn floating-point numbers, simulating the height of each person from left to right after lining up. Each floating-point number must be kept to 2 decimal places, and adjacent numbers are separated by a single space.

Sample Input

6
male 1.72
male 1.78
female 1.61
male 1.65
female 1.70
female 1.56

Sample Output

1.65 1.72 1.78 1.70 1.61 1.56

Constraints

Time limit: 1s, memory limit: 1024KiB for each test case.