#include<iostream>
using namespace std;
int main()
{
int t;
long n;
long x[200002], tmp, y;
cin >> t;
while (t--)
{
tmp = 0;
cin >> n;
for (long long i = 0; i < n; i++)
{
cin >> x[i];
}
for (long long i = 0; i < n; i++)
{
cin >> y;
if (abs(y - x[i]) > tmp)
tmp = abs(y - x[i]);
}
cout << tmp << endl;
}
return 0;
}