#include using namespace std; #define int long long #define double long double int x[1005],y[1005],r[1005]; vector v[1005]; bool ok[1005]; int nr,nr1; bool valid; int le[1005]; const int N = 1e4; int a[N], b[N]; void find() { int n; cin>>n; for (int i = 0; i < n; ++i) cin >> a[i]; for (int i = 0; i < n; ++i) cin >> b[i]; sort (a, a + n); sort (b, b + n); int res = 0; for (int i = 0; i < n; ++i) { int cur = 1e9, n1 = n - i; for (int j = 0; j < n1; ++j) cur = min (cur, abs (a[i + j] - b[j])); for (int j = 0; j < n - n1; ++j) cur = min (cur, abs (a[j] - b[n1 + j])); res = max (res, cur); } cout << res << "\n"; return ; } int32_t main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int t = 1; cin >> t; while(t--) { find(); } return 0; }