#include using namespace std; using vi = vector; void solve() { int n; cin >> n; vi a(n); vi b(n); for(int i = 0; i < n; i++) cin >> a[i]; for(int i = 0; i < n; i++) cin >> b[i]; sort(a.begin(), a.end()); sort(b.begin(), b.end()); int best = 0; for(int off = 0; off < n; off++) { int ans = 1e9 + 7; for(int i = 0; i < n; i++) { int j = (i + off) % n; ans = min(ans, abs(a[i] - b[j])); } best = max(best, ans); } cout << best << endl; } int main(){ ios::sync_with_stdio(false); cin.tie(NULL); int tc; cin >> tc; while(tc--) { solve(); } }