#include using namespace std; void solve(){ int n; cin >> n; vector a(n); vector b(n); for(auto &x : a)cin >> x; for(auto &x : b)cin >> x; sort(a.begin(), a.end()); sort(b.begin(), b.end()); int ans = 0; for(int i = 0; i < n; ++i){ int mx = 1 << 30; for(int j = 0; j < n; ++j){ mx = min(mx, abs(a[j] - b[(j + i) % n])); } ans = max(ans, mx); } cout << ans << '\n'; } int main(){ ios_base::sync_with_stdio(0); cin.tie(0); int t; cin >> t; while(t--)solve(); }