#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define all(x) x.begin(), x.end()
void solve(){
int n;
cin >> n;
vector<int> a(n);
for(int i = 0, x; i<n; ++i){
cin >> a[i];
}
int mx = 0;
for(int i = 0, x; i<n; ++i){
cin >> x;
mx = max(mx, x - a[i]);
}
cout << mx << '\n';
}
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
int t = 1;
cin >> t;
while(t--){
solve();
}
}