#include <iostream>
#include <cmath>
using namespace std;
int main() {
int t,n,max;
cin >> t;
for(int i=0;i<t;i++){
cin >> n;
int wall[n];
int children[n];
int dif[n];
for(int i=0;i<n;i++){
cin>>wall[i];
}
for(int i=0;i<n;i++){
cin>>children[i];
}
max=children[0]-wall[0];
for(int i=0;i<n;i++){
if(children[i]>wall[i])
dif[i]=abs(children[i]-wall[i]);
else
dif[i]=0;
}
for(int i=0;i<n;i++){
if(max<dif[i])
max=dif[i];
}
cout<<max;
}
}