#include #include #include #include #include using namespace std; int main(){ int n;cin>>n; vector> a; a.reserve(n); map m{{"iti",1},{"ni",2},{"san",3},{"yon",4}}; for(int i=0;i>s>>t; a.emplace_back(s,m[t],t); } sort(a.begin(),a.end()); for(auto i:a)cout<(i)<<" "<(i)<<"\n"; }