#include #define x first #define y second using namespace std; using ll=long long; using pii=pair; using vi=vector; using vl=vector; #define pb push_back #define all(a) begin(a),end(a) const int N=300010,MOD=1e9+7; const char en='\n'; const ll LLINF=1ll<<60; int t,n,a[N],b[N],cl[N],cr[N]; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cin>>t; while (t--) { cin>>n; for (int i=0;i>a[i]; for (int i=0;i>b[i]; sort(a,a+n); sort(b,b+n); int lo=0,hi=MOD; while (lo=0;--i) { while (ccr=a[i]+mid) ++ccr; cr[i]=ccr; } int pmi=MOD; bool ok=1; for (int i=0;i