#include <iostream>
#include <algorithm>
using namespace std;
int n = 1000001;
int main() {
int a[n];
int b[n];
int Test;
cin >> Test;
while (Test>0){
int numberOfParts;
int ans=0;
cin >> numberOfParts;
for (int i = 0; i < numberOfParts;i++){
cin>>a[i];
}
for (int i=0;i<numberOfParts;i++){
cin>>b[i];
ans = max (ans , b[i]-a[i]);
}
cout<< ans <<endl;
Test--;
}
return 0;
}