#include #include #include using namespace std; int main() { int n; cin >> n; map, string> cards; for (int i = 0; i < n; ++i) { string mn; cin >> mn; int mark = mn[0] == 'D' ? 0 : mn[0] == 'C' ? 1 : mn[0] == 'H' ? 2 : 3; int number = mn[1] == 'A' ? 1 : mn[1] == 'T' ? 10 : mn[1] == 'J' ? 11 : mn[1] == 'Q' ? 12 : mn[1] == 'K' ? 13 : (int)(mn[1] - '0'); cards[make_pair(mark, number)] = mn; } for (map, string>::const_iterator it = cards.begin(); it != cards.end(); ++it) { cout << it->second << " "; } cout << flush; return 0; }