/******************************************
* AUTHOR : kevin_007 *
******************************************/
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define Speed_UP  ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
clock_t clk=clock();
typedef long long ll;
typedef long double ld;
typedef pair<ld, ld> pt;
#define vi vector<int>
#define vll vector<ll>
#define N 100005
#define MOD 1000000007
#define dd double
#define rep(i, n) for(int i = 0; i < n; i++)
#define repe(i,a,b) for(int i=a;i<b;i++)
#define rep1(i,b) for(int i=1;i<=b;i++)
#define pb push_back
#define sz(x) ((int)(x).size())
#define F first
#define S second
template<class T> using ordered_set = tree<T, null_type, less_equal<T>, 
rb_tree_tag,tree_order_statistics_node_update> ;
// order_of_key (k) : Number of items strictly smaller than k .
// find_by_order(k) : K-th element in a set (counting from zero).

pt func(pt a, pt b) {
    if(b.F>a.S or b.S<a.F) return {-1,-1};

    return {max(a.F,b.F), min(a.S, b.S)};
}

int solve(){

    int n;  cin>>n;

    vll x(n), t(n);    rep(i,n) cin>>x[i];

    rep(i,n) cin>>t[i];

    ld low=0, hi=MOD;
    ld mid;
    ll itr=30;

    ld ans=0;

    while(itr-- and low<=hi) {
        mid=(low+hi)/2;

        bool ok=1;

        pt full = {0, MOD};

        rep(i,n) {
            if(mid<t[i]) {
                ok=0;   break;
            }
			
			// Here Changing ld to ll gives correct answer
            ld diff = mid - t[i];

            pt temp = {x[i] - diff, x[i] + diff};

            full = func(temp, full);

            if(full.F==-1) {
                ok=0;   break;
            }
        }

        if(!ok) {
            low=mid;  
        }
        else {
            hi=mid;   
            ans = (full.F+full.S)/2.0;
        }
    }

    cout<<setprecision(12) << fixed << ans<<"\n";

    return 0;
}

int main() {
    #ifndef ONLINE_JUDGE   
    freopen("input.txt", "r", stdin); 
    // freopen("output.txt", "w", stdout);    
    #endif 
    Speed_UP


    int t;
    cin>>t;

    while(t--){
        solve();
    }

    return 0;

}