#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <unordered_map>
using namespace std;

#define REP(i, s) for (int i = 0; i < s; ++i)
#define ALL(v) (v.begin(), v.end())
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ EACH(it, P) { s << "<" << *it << "> "; } return s << endl; }
template<class T> ostream& operator << (ostream &s, multiset<T> P)
{ EACH(it, P) { s << "<" << *it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }

int N;
vector<long long> a;

int main() {
    while (cin >> N) {
        a.resize(N * 3);
        for (int i = 0; i < N*3; ++i) cin >> a[i];
        
        multiset<long long> zenhan;
        multiset<long long> kouhan; // 大きい順に reverse
        multiset<long long> kouhan2;
        
        long long szen = 0, skou = 0;
        for (int i = 0; i < N; ++i) {
            zenhan.insert(a[i]);
            szen += a[i];
        }
        for (int i = N; i < N*3; ++i) {
            if (kouhan.size() < N) {
                kouhan.insert(-a[i]);
                skou += a[i];
            }
            else {
                long long top = -*kouhan.begin();
                if (a[i] < top) {
                    kouhan.erase(kouhan.lower_bound(-top));
                    kouhan.insert(-a[i]);
                    kouhan2.insert(top);
                    skou += a[i];
                    skou -= top;
                }
                else {
                    kouhan2.insert(a[i]);
                }
            }
        }
        
        long long res = szen - skou;
        
        
        for (int i = N; i < N*2; ++i) {
            // zenhan
            long long top = *zenhan.begin();
            if (a[i] >= top) {
                zenhan.erase(zenhan.lower_bound(top));
                zenhan.insert(a[i]);
                szen -= top;
                szen += a[i];
            }
            
            // kouhan
            top = -*kouhan.begin();
            if (a[i] <= top) {
                kouhan.erase(-a[i]);
                long long rem = *kouhan2.begin();
                kouhan2.erase(kouhan2.lower_bound(rem));
                kouhan.insert(-rem);
                skou -= a[i];
                skou += rem;
            }
            else {
                kouhan2.erase(kouhan2.lower_bound(a[i]));
            }
            
            /*
            cout << i << ": " << szen << ", " << skou << endl;
            COUT(zenhan);
            COUT(kouhan);
            COUT(kouhan2);
             */
            
            chmax(res, szen - skou);
        }
        
        cout << res << endl;
        
    }
}





























Measured memory_bytes: 18688