/*
_ _ _ __ __ _____
/\ | | /\ | | | | | \/ |/ ____|
/ \ | |__ ___ / \ | |__ __| | ___ | \ / | |
/ /\ \ | '_ \ / _ \ / /\ \ | '_ \ / _` |/ _ \| |\/| | |
/ ____ \| |_) | (_) / ____ \| |_) | (_| | (_) | | | | |____
/_/ \_\_.__/ \___/_/ \_\_.__/ \__,_|\___/|_| |_|\_____|
*/
#include<bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define pb push_back
#define all(x) x.begin(), x.end()
#define sz(x) ((int)(x).size())
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ld eps = 1e-9;
const int mod = 1e9 + 7;
const int oo = 1e9 + 7;
const ll lloo = 1e18 + 7;
const int N = 1e6 + 7;
void solve();
int main()
{
// freopen("in","r",stdin);
// freopen("out","w",stdout);
int T = 1;
scanf("%d",&T);
while(T--) solve();
return 0;
}
int n;
int a[N],b[N];
void solve()
{
scanf("%d",&n);
for(int i = 0 ; i < n ; i++) scanf("%d",a+i);
for(int i = 0 ; i < n ; i++) scanf("%d",b+i);
int ans = 0;
for(int i = 0 ; i < n ; i++) {
ans = max(ans,b[i]-a[i]);
}
printf("%d\n",ans);
}
Copy