#include <stdio.h>

```
int main()
{
int t, piesOccupied;
scanf("%d", &t);
while (t--)
{
int n, i, j;
scanf("%d", &n);
piesOccupied = 0;
int piesWeight[100];
piesWeight[0] = 0;
int racksWeight[100];
racksWeight[0] = 0;
for(i = 0; i < n; i++)
{
scanf("%d", &piesWeight[i]);
}
for(i = 0; i < n; i++)
{
scanf("%d", &racksWeight[i]);
}
for(i = 0; i < n; i++)
{
int min = 101;
int loc = 101;
for(j = 0; j < n; j++)
{
if(piesWeight[i] <= racksWeight[j])
{
if(min > racksWeight[j])
{
min = racksWeight[j];
loc = j;
}
}
}
if(loc != 101)
{
racksWeight[loc] = 0;
piesOccupied++;
}
}
printf("%d\n", piesOccupied);
}
return 0;
```

}