#include using namespace std; using ll = long long; bool check(int mid, vector & a, vector & b, int n){ for(int i = 0; i < n; i++) { bool cond = true; for(int j = 0; j < n; j++) { if(j < i) { if(abs(a[j] - b[j + n - i]) < mid) cond = false; } else { if(abs(a[j] - b[j - i]) < mid) cond = false; } } if(cond) return true; } return false; } void solve(){ int n; cin >> n; vector a(n), 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()); for(int i = 0; i < n; i++) { } int first = 0, last = 1e9; while (first < last){ int mid = (first + last + 1) / 2; if (check(mid, a, b, n)) first = mid; else last = mid - 1; } cout << first << "\n"; } int main(){ ios_base::sync_with_stdio(false); cin.tie(0); int t; cin >> t; while (t--) solve(); }