#include <bits/stdc++.h>
using namespace std;
#define int              long long int
#define double           long double
#define print(a)         for(auto x : a) cout << x << " "; cout << endl
inline int power(int a, int b) {
    int x = 1;
    while (b) {
        if (b & 1) x *= a;
        a *= a;
        b >>= 1;
    }
    return x;
}


const int M = 1000000007;
const int N = 3e5+9;
const int INF = 2e9+1;
const int LINF = 2000000000000000001;

//_ ***************************** START Below *******************************

vector<int> a;
vector<int> b;


bool isPossible(int n, int m, int mid){

    for(int i=0; i<n; i++){
        int val = a[i];
        int minR = a[i]-mid;
        int maxR = a[i]+mid;

        auto maxCt = lower_bound(begin(b), end(b), maxR) - begin(b);
        auto minCt = lower_bound(begin(b), end(b), minR) - begin(b);

        if((maxCt<m && b[maxCt] == maxR) || (minCt<m && b[minCt] == minR)) {
            continue;
        }

        if(maxCt - minCt <= 0) return false;
        
    }

    return true;
}

int consistency(int n, int m){

    int s = 0, e = INF;
    int ans = INF;
    while(s<=e){
        int mid = s + (e-s)/2;

        if(isPossible(n, m, mid)){
            ans = min(ans, mid);
            e = mid-1;
        }
        else s = mid+1;
    }

    return ans;

}








//* a => Cities, b => towers

bool isPoss(int n, int m, int mid){
	
	
	int x = -1, y = -1;
	vector<int> intervals;
	
	for(int i=0; i<m; i++){
		int p = b[i]-mid;
		int q = b[i]+mid;
		
		if(x == -1 && y==-1){
			x = p;
			y = q;
		}
		else{
			if(y >= p){
				y = max(y,q);
			}
			else{
				intervals.push_back(x);
				intervals.push_back(y);
			}
		}
	}
	intervals.push_back(x);
	intervals.push_back(y);
	
	int ct = 0;
	for(int i=0; i<n; i++){
		int j = lower_bound(begin(intervals), end(intervals), a[i]) - begin(intervals);
		if(j==intervals.size()) continue;
		
		if(j==a[i]) ct++;
		if(j&1 && a[i] <= j){
			ct++;
		}
	}
	return ct == n;
}

int practice(int n, int m){
	
	int s = 0, e = INF;
	
	while(s<e){
		int mid = s + (e-s)/2;
		if(isPoss(n, m, mid)){
			e = mid;
		}
		else s = mid+1;
	}
	
	return e;
	
}






void solve() {
    
    int n, m;
    cin>>n>>m;
    a.resize(n);
    b.resize(m);
    
    for(int i=0; i<n; i++) cin >> a[i];
    for(int i=0; i<m; i++) cin >> b[i];
    // cout << consistency(n, m) << endl;
    
    cout << practice(n, m) << endl;


}





int32_t main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

    int t = 1;
    cin >> t;
    while (t--) {
        solve();
    }

    return 0;
}