#include <stdio.h>
int main(){
int t,n,i,j,k,l,sort;
scanf("%d",&t);
int count[t];
for(i = 0;i<t;i++){
scanf("%d",&n);
int a[n],b[n],diff[n];
for(j = 0;j<n;j++){
scanf("%d",&a[j]);
}
for(j = 0;j<n;j++){
scanf("%d",&b[j]);
}
for(j = 0;j<n;j++){
diff[j]=b[j]-a[j];
for(k = 0;k<n;k++){
for(l = k+1;l<n;l++){
if(diff[k]>diff[l]){
sort=diff[k];
diff[k]=diff[l];
diff[l]=sort;
}
}
}
}
if(diff[n-1]>0){
count[i] = diff[n-1];
}
else{
count[i]=0;
}
}
for(i = 0;i<t;i++){
printf("%d\n",count[i]);
}
return 0;
}
Copy