#include #include #include #include #include #include #include using namespace std; int main() { int t; while (cin >> t) { map map_1; map_1.clear(); string str1 ; while (t--) { cin >> str1; sort(str1.begin(), str1.end()); cout << map_1[str1] << endl; map_1[str1]++; } } return 0; }