#include using namespace std; int main() { cin.tie(nullptr)->sync_with_stdio(false); int T; cin >> T; while (T--) { int n; cin >> n; auto a = vector(n); auto b = vector(n); for (int &x : a) cin >> x; for (int &x : b) cin >> x; std::sort(a.begin(), a.end()); std::sort(b.begin(), b.end()); int best = 0; for (int offset = 0; offset != n; ++offset) { int val = 2e9; for (int i = 0; i != n; ++i) { int j = i + offset; if (j >= n) j -= n; val = min(val, abs(a[i] - b[j])); } best = max(best, val); } cout << best << '\n'; } }