#include #include using namespace std; using ll = long long; #define rep(i, s, t) for (ll i = s; i < (ll)(t); i++) template bool chmin(T &x, T y) { return x > y ? (x = y, true) : false; } template bool chmax(T &x, T y) { return x < y ? (x = y, true) : false; } struct io_setup { io_setup() { ios::sync_with_stdio(false); std::cin.tie(nullptr); cout << fixed << setprecision(15); } } io_setup; int main(){ int n; cin>>n; vector a(n),b(n-1); rep(i,0,n) cin>>a[i]; rep(i,0,n-1) cin>>b[i]; sort(a.begin(),a.end()); sort(b.begin(),b.end()); vector dp(n,0); rep(i,0,n-1){ dp[i+1]=dp[i]+abs(a[i]-b[i]); } vector rdp(n,0); reverse(a.begin(),a.end()); reverse(b.begin(),b.end()); rep(i,0,n-1){ rdp[i+1]=rdp[i]+abs(a[i]-b[i]); } reverse(rdp.begin(),rdp.end()); reverse(a.begin(),a.end()); reverse(b.begin(),b.end()); map> mp; rep(i,0,n){ mp[dp[i]+rdp[i]].insert(a[i]); } auto[mn,st]=*mp.begin(); cout<