// 也不知道这题是不是动态规划,好像不是,应该算是贪心。
/**
刚开始还以为这道题是图论什么的,
后来看别人的代码才发现原来如此简单,惭愧啊!
其实就是计算每节走廊被使用的重叠的次数,取其中的最大次数*10即为所求。
**/
#include <stdio.h>
#include <string.h>
int main()
{
int t, n, i, temp;
int from, to, a[401], max;
scanf("%d", &t);
while (t--)
{
memset(a, 0, sizeof(a));
scanf("%d", &n);
while (n--)
{
scanf("%d %d", &from, &to);
if (from > to) //此步骤容易忽略
{
temp = from;
from = to;
to = temp;
}
if (from%2 == 0) from--;
if (to%2 != 0) to++;
for (i=from; i<=to; i++)
{
a[i]++;
}
}
max = a[1];
for (i=2; i<=400; i++)
{
if (a[i] > max) max = a[i];
}
printf("%d/n", 10*max);
}
}