#include <stdio.h>
int main()
{
int m,n,i,j,count;
while (scanf("%d",&m) == 1 )
{
while(m--)
{
scanf("%d",&n);
struct BasePoint{
int value;
int t;
};
BasePoint arr[100];
for(i=0;i<n;i++)
{
scanf("%d",&arr[i].value);
}
for(i=1;i<n;i++)
{
count = 0;
for(j=0;j<i;j++)
{
if (arr[j].value == arr[i].value)
{
arr[i].value = arr[j].value;
count ++;
arr[i].t = count;
}
}
}
}
}
}