#include using namespace std; vector a, b, c; void solve(){ int n; cin >> n; a = b = vector(n, 0); c.clear(); for(auto &x : a) cin >> x; for(auto &x : b) cin >> x; sort(a.begin(), a.end()); sort(b.begin(), b.end()); int res = 0; for(int i = 0;i <= n;i++){ int now = 1e9; for(int j = 0; j < n; j++){ now = min(now, abs(a[j] - b[j])); } res = max(res, now); vectortmp; for(int j = 1;j < n;j++){ tmp.push_back(a[j]); } tmp.push_back(a[0]); a = tmp; } cout << res << endl; } int main(){ ios_base::sync_with_stdio(false);cin.tie(NULL); int t = 1; cin >> t; // comment if not multitest while(t--) solve(); }