文件目录

#include <bits/stdc++.h>
using namespace std;
multiset<double> s1, s2;
int main()
{
    int n;
    string s;
    double a;
    cin >> n;
    while (n--)
    {
        cin >> s >> a;
        if (s == "female")
            s1.insert(a);
        else
            s2.insert(a);
    }
    for (auto i = s2.begin(); i != s2.end(); i++)
        printf("%.2lf ", *i);
    for (auto i = s1.rbegin(); i != s1.rend(); i++)
        printf("%.2lf ", *i);
    return 0;
}