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