//找出几个搬动区间的重叠部分重叠次数最多的次数即为整个搬动任务的最少搬动次数(可以同时)
//房间是两侧的,注意处理奇偶性
#include<iostream>
using namespace std;
int a[401];
int main(void)
{
int T, s, e,t,n,max;
cin >> T;
while (T--)
{
memset(a, 0, sizeof(a));
cin >> n;
while (n)
{
cin >> s >> e;
if (s > e)
{
t = s; s = e; e = t;
}
if (s % 2 == 0)s -= 1;
if (e % 2 == 0)e -= 1;
for (int i = s; i <= e; i++)
{
a[i]++;
}
n--;
}
max = 0;
for (int i = 1; i <=400; i++)
{
if (a[i] > max) max = a[i];
}
cout << max * 10 << endl;
}
return 0;
}
//房间是两侧的,注意处理奇偶性
#include<iostream>
using namespace std;
int a[401];
int main(void)
{
int T, s, e,t,n,max;
cin >> T;
while (T--)
{
memset(a, 0, sizeof(a));
cin >> n;
while (n)
{
cin >> s >> e;
if (s > e)
{
t = s; s = e; e = t;
}
if (s % 2 == 0)s -= 1;
if (e % 2 == 0)e -= 1;
for (int i = s; i <= e; i++)
{
a[i]++;
}
n--;
}
max = 0;
for (int i = 1; i <=400; i++)
{
if (a[i] > max) max = a[i];
}
cout << max * 10 << endl;
}
return 0;
}