#include <iostream>
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 < bi - ai[i])
tmp = bi - ai[i];
}
cout << tmp << endl;
}
return 0;
}