#include using namespace std; typedef long long ll; typedef pair pii; #define fi first #define se second #define mp make_pair #define fastIO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0); int main(){ fastIO; int tc; cin >> tc; for(int iq = 1; iq <= tc; iq ++ ){ 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()); int res = 0; vector aa(n); for(int i = 0 ; i < n; i ++ ){ aa[i]=(int)2e9; } for(int i = 0 ; i < n; i ++ ){ for(int j = 0 ; j < n; j ++) { aa[(j - i + n) % n] = min(aa[(j - i + n) % n], abs(b[j]-a[i])); } } for(int i = 0 ; i < n; i ++ ){ res=max(res,aa[i]); } cout << res << "\n"; } return 0; }