#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define ss second
#define ff first
#define pb push_back
#define mk make_pair
ll a[2000000],b[200100];
int main(){
int t;
cin>>t;
while(t--){
int n;
ll ans=0;
cin>>n;
for(int i=0;i<n;i++)cin>>a[i];
for(int i=0;i<n;i++){
cin>>b[i];
ans=max(ans,b[i]-a[i]);
}
cout<<ans<<endl;
}
}