#include using namespace std; using ll = long long; using ld = long double; int main(){ ll t; cin >> t; while(t){ ll n; cin >> n; vector a; vector b; for(ll i = 0; i < n; i++){ ll x; cin >> x; a.push_back(x); } for(ll i = 0; i < n; i++){ ll x; cin >> x; b.push_back(x); } sort(a.begin(),a.end()); sort(b.begin(),b.end()); ll record = 0; for(int shift = 0; shift < n; shift++){ ll worst_pair = -1; for(int i = 0; i < n; i++){ ll other = i+shift; if(other >= n){ other -= n; } ll diff = a[i] - b[other]; if(diff < 0){ diff *= -1; } if(diff < worst_pair || worst_pair == -1){ worst_pair = diff; } } if(worst_pair > record){ record = worst_pair; } } cout << record << endl; t--; } }