#include #include #include #include #include #include using namespace std; char s[45]; mapm; string temp; int main(){ int n,i,j,len; while(scanf("%d",&n)!=EOF){ m.clear(); for(i=1;i<=n;i++){ scanf("%s",s); len=strlen(s); sort(s,s+len); temp=s; printf("%d\n",m[temp]); m[temp]++; } } return 0; }