#include<iostream>
#include<algorithm>
using namespace std;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int TC; cin >> TC;
while(TC--) {
int n; cin >> n;
int arr[n];
for(int i = 0; i < n; ++i) cin >> arr[i];
int mx = 0;
for(int i = 0; i < n; ++i) {
int b; cin >> b;
mx = max(mx, b - arr[i]);
}
cout << mx << "\n";
}
return 0;
}