#include <iostream> #include <vector> #include <queue> using namespace std; int n; struct Node{ int in; int point; }; bool operator < (Node a, Node b) //小根堆的重载 { if(a.in == b.in) return a.point > b.point; else return a.in > b.in; } int main() { while(cin >> n) { string s; vector<int> in(n); for(int i = 0; i < n; i++) { cin >> s; if(s[6] == 'N') continue; int pos = 10; while(pos < s.size()) { int to = s[pos] - '0'; in[to]++; pos += 6; } } priority_queue<Node> q; for(int i = 0; i < in.size(); i++) { Node node; node.in = in[i]; node.point = i; q.push(node); } while(!q.empty()) { cout << "Task" << q.top().point << " "; q.pop(); } } }