/* I am not the best, but I am better than your father. */
#include <bits/stdc++.h>
using namespace std;
using ll=long long ;
#define len(s) (int)s.size()
#define ss second
#define ff first
#define all(a) a.begin(),a.end()
#define s(a,b) for ( int i = a ; i < b ; i++)
#define q(a,b) for ( int j = a ; j < b ; j++)
void solve ()
{
int n , m ;
cin >>n >> m;
int arr[m];
arr[0]=1;
s(1,n+1)
arr[i]=i*arr[i-1];
cout<< arr[n]/(arr[m]*arr[n-m])<<endl;
}
void solve2()
{
int n;
cin>>n;
int arr[n], arr1[n];
s(0,n)
cin>>arr[i];
s(0,n)
cin>>arr1[i];
int ma= 0;
s(0,n)
{
if(arr1[i]>arr[i])
{
int z =arr1[i]-arr[i];
ma=max(ma,z);
}}
cout<<ma<<"\n";
}
int main() {
// solve();
ll t;
cin >> t;
while(t--){
solve2();
}
}
Copy