#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll N = 10e5;
int x = 1;
void DGS()
{
int n; cin>>n;
vector<int> a(n) , b(n);
for(auto &x : a) cin>>x;
for(auto &y : b) cin>>y;
int max = 0;
for(int i=0;i<n;i++){
int dif = b[i] - a[i];
if(dif > max) max = dif;
}
cout<<max;
}
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
ll n=1;
cin>>n;
while(n--) {DGS(); cout<<'\n';}
}