#include <iostream>
#include <cstdio>
#include <string>

using namespace std;

const int N = 5e3;

string s;
int q;
pair <int, bool> dp[N][N];

int main(){
    //freopen("input.txt", "r", stdin);
    cin >> s;
    cin >> q;
    int n = s.size();
    for (int i = 0; i < n; i++){
        for (int j = 0; j < n; j++){
            if (i == j)
                dp[i][j].first = 1;
            dp[i][j].second = 1;
        }
    }
    for (int k = 1; k < n; k++){
        int j = k;
        int i = 0;
        if(j > i)
        for (int l = k; j < n; l++){
                dp[i][j].second = (dp[i + 1][j - 1].second && s[i] == s[j] ? 1 : 0);
                dp[i][j].first = dp[i][j - 1].first + dp[i + 1][j].first - dp[i + 1][j - 1].first + dp[i][j].second;
            i++;
            j++;
        }
    }
    for (int i = 0; i < q; i++){
        int a, b;
        scanf("%d %d", &a, &b);
        a--;
        b--;
        printf("%d\n", dp[a][b]);
    }
    return 0;
}


#include <iostream>
#include <cstdio>
#include <string>

using namespace std;

const int N = 5e3;

string s;
int q;
pair <int, bool> dp[N][N];

int main(){
    //freopen("input.txt", "r", stdin);
    cin >> s;
    cin >> q;
    int n = s.size();
    for (int i = 0; i < n; i++){
        for (int j = 0; j < n; j++){
            if (i == j)
                dp[i][j].first = 1;
            dp[i][j].second = 1;
        }
    }
    for (int k = 1; k < n; k++){
        int j = k;
        int i = 0;
        for (int l = k; j < n; l++){
                dp[i][j].second = (dp[i + 1][j - 1].second && s[i] == s[j] ? 1 : 0);
                dp[i][j].first = dp[i][j - 1].first + dp[i + 1][j].first - dp[i + 1][j - 1].first + dp[i][j].second;
            i++;
            j++;
        }
    }
    for (int i = 0; i < q; i++){
        int a, b;
        scanf("%d %d", &a, &b);
        a--;
        b--;
        printf("%d\n", dp[a][b]);
    }
    return 0;
}


#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
using namespace std;

int n, m, dp[5000][5000], q, l, r;
string s;
vector<int> start[5000];

void precalc(int n)
{
    for(int i=0; i<n; i++)
    {
        for(int j=0; i-j >= 0 && i+j<n && s[i-j] == s[i+j] ; j++)
        {
            start[i+j].push_back(i-j);
        }

        for(int j=0; i-j-1>=0 && i+j<n && s[i-j-1] == s[i+j]; j++)
        {
            start[i+j].push_back(i-j-1);
        }
    }

    for(int i=0; i<n; i++)
    {
        int cur = 0;
        for(int j=i; j<n; j++)
        {
            sort(start[j].begin(), start[j].end());
            int l = -1;
            int r = start[j].size();

            while(r-l>1)
            {
                int m = (r+l)>>1;
                if(start[j][m] >= i)
                    r = m;
                else
                    l = m;
            }
            cur += start[j].size() - r;
            dp[i][j] = cur;
        }
    }
}

int main()
{
    //freopen("input.txt","r",stdin);
    cin>>s;
    scanf("%d",&n);
    precalc(s.size());
    for(int i=0; i<n; i++)
    {
        scanf("%d %d",&l,&r);
        printf("%d\n",dp[l-1][r-1]);
    }

return 0;
}


#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
using namespace std;

int n, m, dp[5000][5000], q, l, r, chet[5000], nechet[5000];
string s;
vector<int> start[5000];

void precalc(int n)
{
    for(int i=0; i<n; i++)
    {
        int cur = 0;
        for(int j=0; i-j >= 0 && i+j<n && s[i-j] == s[i+j] ; j++)
        {
            //start[i+j].push_back(i-j);
            cur++;
            nechet[i] = cur;
        }

        cur = 0;
        for(int j=0; i-j-1>=0 && i+j<n && s[i-j-1] == s[i+j]; j++)
        {
            //start[i+j].push_back(i-j-1);
            cur++;
            chet[i] = cur;
        }
    }

    for(int i=0; i<n; i++)
    {
        for(int j=0; j<=i; j++)
        {
            int p1 = -1;
            int p2 = -1;
            if(j + nechet[j] -1 >= i)
                p1 = (j-i+j);

            if(j + chet[j] - 1 >= i)
                p2 = (j-i+j-1);

            if(p1 < p2)
                swap(p1,p2);
            if(p2 != -1)
                start[i].push_back(p2);
            if(p1 != -1)
                start[i].push_back(p1);
        }
    }

    for(int i=0; i<n; i++)
    {
        int cur = 0;
        for(int j=i; j<n; j++)
        {
            //sort(start[j].begin(), start[j].end());
            int l = -1;
            int r = start[j].size();

            while(r-l>1)
            {
                int m = (r+l)>>1;
                if(start[j][m] >= i)
                    r = m;
                else
                    l = m;
            }
            cur += start[j].size() - r;
            dp[i][j] = cur;
        }
    }
}

int main()
{
    //freopen("input.txt","r",stdin);
    cin>>s;
    scanf("%d",&n);
    precalc(s.size());
    for(int i=0; i<n; i++)
    {
        scanf("%d %d",&l,&r);
        printf("%d\n",dp[l-1][r-1]);
    }

return 0;
}


#include<cstdio>
#include<cstdlib>
#include<fstream>
#include<queue>
#include<stack>
#include<memory.h>
#include<algorithm>
#include<vector>
#include<list>
#include<set>
#include<string>
#include<map>
#include<cmath>
#include<iostream>
#include<ctime>
#define mp make_pair
#define pb push_back
#define F first
#define S second
#define m0(x) memset(x,0,sizeof(x))
#define m1(x) memset(x,1,sizeof(x))
#define maxn 5002
using namespace std;
int ans[maxn][maxn]={},d[maxn][maxn] = {},k,i,j,n;
string s;

int main(){
#ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif
cin >> s;
n = s.size();
s = " " + s;
for(i=1;i<=n;i++)ans[i][i] = d[i][i] = 1;
 for(i=1;i<=n;i++)
  for(j=1;j<=n-i;j++){
   int k = j + i;
   if((d[j+1][k-1] == 1 || abs(k - j) < 2) && s[j] == s[k])d[j][k] = 1;
   ans[j][k] = ans[j][k-1] + ans[j+1][k] - ans[j+1][k-1] + d[j][k];
  }
cin >> n;
 for(i=1;i<=n;i++){
  cin >> k >> j;
  cout << ans[k][j] << endl;
 }
return 0;
}


#include<cstdio>
#include<cstdlib>
#include<fstream>
#include<queue>
#include<stack>
#include<memory.h>
#include<algorithm>
#include<vector>
#include<list>
#include<set>
#include<string>
#include<map>
#include<cmath>
#include<iostream>
#include<ctime>
#define mp make_pair
#define pb push_back
#define F first
#define S second
#define m0(x) memset(x,0,sizeof(x))
#define m1(x) memset(x,1,sizeof(x))
#define maxn 5002
using namespace std;
int ans[maxn][maxn]={},d[maxn][maxn] = {},k,i,j,n;
string s;

int main(){
#ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif
cin >> s;
n = s.size();
s = " " + s;
 for(i=1;i<=n;i++)
  for(j=1;j<=n-i+1;j++){
   int k = j + i - 1;
   if((d[j+1][k-1] == 1 || abs(k - j) < 2) && s[j] == s[k])d[j][k] = 1;
   ans[j][k] = ans[j][k-1] + ans[j+1][k] - ans[j+1][k-1] + d[j][k];
  }
cin >> n;
 for(i=1;i<=n;i++){
  cin >> k >> j;
  cout << ans[k][j] << endl;
 }
return 0;
}


#include<cstdio>
#include<cstdlib>
#include<fstream>
#include<queue>
#include<stack>
#include<memory.h>
#include<algorithm>
#include<vector>
#include<list>
#include<set>
#include<string>
#include<map>
#include<cmath>
#include<iostream>
#include<ctime>
#define mp make_pair
#define pb push_back
#define F first
#define S second
#define m0(x) memset(x,0,sizeof(x))
#define m1(x) memset(x,1,sizeof(x))
#define maxn 5555
using namespace std;
int ans[maxn][maxn]={},k,i,j,n;
string s;

int main(){
#ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif
cin >> s;
n = s.size();
s = " " + s;
for(i=1;i<=n;i++)ans[i][i] = 1;
 for(i=1;i<=n;i++)
  for(j=1;j<=n-i;j++){
   int k = j + i;
   ans[j][k] += ans[j][k-1] + ans[j+1][k] - ans[j+1][k-1];
   if(s[j] == s[k])ans[j][k]++;
  }
cin >> n;
 for(i=1;i<=n;i++){
  cin >> k >> j;
  cout << ans[k][j] << endl;
 }
return 0;
}


#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <string>
#include <vector>
#include <iostream>
#include <algorithm>
#include <numeric>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <fstream>

#define REP(I, N) for (int I = 0; I < (N); ++I)
#define PER(I, N) for (int I = (N); I >= 0; --I)
#define PERR(I, A, B) for (int I = (A); I >= (B); --I)
#define REPP(I, A, B) for (int I = (A); I <  (B); ++I)
#define REPN(I, A, B) for (int I = (A); I <= (B); ++I)
#define REPC(I, A, C) for (int I = (A); (C); ++I)
#define REPPP(I, A, B, C) for (int I = (A); I <  (B); I += C)
#define RI(X) scanf("%d", &(X))
#define RII(X, Y) scanf("%d%d", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%d%d%d", &(X), &(Y), &(Z))
#define RIIII(X, Y, Z, W) scanf("%d%d%d%d", &(X), &(Y), &(Z), &(W))
#define DRI(X) int (X); scanf("%d", &X)
#define DRII(X, Y) int X, Y; scanf("%d%d", &X, &Y)
#define DRIII(X, Y, Z) int X, Y, Z; scanf("%d%d%d", &X, &Y, &Z)
#define DRIIII(X, Y, Z, W) int X, Y, Z, W; scanf("%d%d%d%d", &X, &Y, &Z, &W)
#define RS(X) scanf("%s", (X))
#define LEN(X) int(strlen(X))
#define SZ(X) int((X).size())
#define SUM(X, N) accumulate(X, X + (N), 0)
#define MS0(X) memset((X), 0, sizeof(X))
#define MSI(X) memset((X), 0xFF, sizeof(X))
#define F first
#define S second
#define MP make_pair
#define PB push_back

#ifdef DK
const int MAX = 7;
#else
const int MAX = 2e5 + 11;
#endif

using namespace std;

int64_t N, M, A[MAX], B[MAX];

int main() {
#ifdef DK
  freopen("in.txt", "r", stdin);
#endif
  cin >> N;
  REP(i, N) cin >> A[i];
  cin >> M;
  REP(i, M) cin >> B[i];
  sort(A, A + N);
  sort(B, B + M);
  int64_t a = 0, b = 0, mx = -1e8;
  REP(k, N) {
    int64_t i = lower_bound(A, A + N, A[k]) - A;
    int64_t j = lower_bound(B, B + M, A[k]) - B;
    int64_t x = (N - i) * 3 + i * 2;
    int64_t y = (M - j) * 3 + j * 2;

    if (x - y > mx) {
      mx = x - y;
      a = x;
      b = y;
    } else if (x - y == mx) {
      if (a > x) {
        a = x;
        b = y;
      }
    }
  }
  cout << a << ":" << b;
  return 0;
}


#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <string>
#include <vector>
#include <iostream>
#include <algorithm>
#include <numeric>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <fstream>

#define REP(I, N) for (int I = 0; I < (N); ++I)
#define PER(I, N) for (int I = (N); I >= 0; --I)
#define PERR(I, A, B) for (int I = (A); I >= (B); --I)
#define REPP(I, A, B) for (int I = (A); I <  (B); ++I)
#define REPN(I, A, B) for (int I = (A); I <= (B); ++I)
#define REPC(I, A, C) for (int I = (A); (C); ++I)
#define REPPP(I, A, B, C) for (int I = (A); I <  (B); I += C)
#define RI(X) scanf("%d", &(X))
#define RII(X, Y) scanf("%d%d", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%d%d%d", &(X), &(Y), &(Z))
#define RIIII(X, Y, Z, W) scanf("%d%d%d%d", &(X), &(Y), &(Z), &(W))
#define DRI(X) int (X); scanf("%d", &X)
#define DRII(X, Y) int X, Y; scanf("%d%d", &X, &Y)
#define DRIII(X, Y, Z) int X, Y, Z; scanf("%d%d%d", &X, &Y, &Z)
#define DRIIII(X, Y, Z, W) int X, Y, Z, W; scanf("%d%d%d%d", &X, &Y, &Z, &W)
#define RS(X) scanf("%s", (X))
#define LEN(X) int(strlen(X))
#define SZ(X) int((X).size())
#define SUM(X, N) accumulate(X, X + (N), 0)
#define MS0(X) memset((X), 0, sizeof(X))
#define MSI(X) memset((X), 0xFF, sizeof(X))
#define F first
#define S second
#define MP make_pair
#define PB push_back

#ifdef DK
const int MAX = 7;
#else
const int MAX = 2e5 + 11;
#endif

using namespace std;

int64_t N, M, A[MAX], B[MAX];

int main() {
#ifdef DK
  freopen("in.txt", "r", stdin);
#endif
  cin >> N;
  REP(i, N) cin >> A[i];
  cin >> M;
  REP(i, M) cin >> B[i];
  sort(A, A + N);
  sort(B, B + M);
  int64_t a = 0, b = 0, mx = -1e8;
  REP(k, N) {
    int64_t i = lower_bound(A, A + N, A[k]) - A;
    int64_t j = lower_bound(B, B + M, A[k]) - B;
    int64_t x = (N - i) * 3 + i * 2;
    int64_t y = (M - j) * 3 + j * 2;

    if (x - y > mx) {
      mx = x - y;
      a = x;
      b = y;
    } else if (x - y == mx) {
      if (a > x) {
        a = x;
        b = y;
      }
    }
  }
  REP(k, M) {
    int64_t i = lower_bound(A, A + N, B[k]) - A;
    int64_t j = lower_bound(B, B + M, B[k]) - B;
    int64_t x = (N - i) * 3 + i * 2;
    int64_t y = (M - j) * 3 + j * 2;

    if (x - y > mx) {
      mx = x - y;
      a = x;
      b = y;
    } else if (x - y == mx) {
      if (a > x) {
        a = x;
        b = y;
      }
    }
  }
  cout << a << ":" << b;
  return 0;
}


#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <string>
#include <vector>
#include <iostream>
#include <algorithm>
#include <numeric>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <fstream>

#define REP(I, N) for (int I = 0; I < (N); ++I)
#define PER(I, N) for (int I = (N); I >= 0; --I)
#define PERR(I, A, B) for (int I = (A); I >= (B); --I)
#define REPP(I, A, B) for (int I = (A); I <  (B); ++I)
#define REPN(I, A, B) for (int I = (A); I <= (B); ++I)
#define REPC(I, A, C) for (int I = (A); (C); ++I)
#define REPPP(I, A, B, C) for (int I = (A); I <  (B); I += C)
#define RI(X) scanf("%d", &(X))
#define RII(X, Y) scanf("%d%d", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%d%d%d", &(X), &(Y), &(Z))
#define RIIII(X, Y, Z, W) scanf("%d%d%d%d", &(X), &(Y), &(Z), &(W))
#define DRI(X) int (X); scanf("%d", &X)
#define DRII(X, Y) int X, Y; scanf("%d%d", &X, &Y)
#define DRIII(X, Y, Z) int X, Y, Z; scanf("%d%d%d", &X, &Y, &Z)
#define DRIIII(X, Y, Z, W) int X, Y, Z, W; scanf("%d%d%d%d", &X, &Y, &Z, &W)
#define RS(X) scanf("%s", (X))
#define LEN(X) int(strlen(X))
#define SZ(X) int((X).size())
#define SUM(X, N) accumulate(X, X + (N), 0)
#define MS0(X) memset((X), 0, sizeof(X))
#define MSI(X) memset((X), 0xFF, sizeof(X))
#define F first
#define S second
#define MP make_pair
#define PB push_back

#ifdef DK
const int MAX = 7;
#else
const int MAX = 2e5 + 11;
#endif

using namespace std;

int64_t N, M, A[MAX], B[MAX];

int main() {
#ifdef DK
  freopen("in.txt", "r", stdin);
#endif
  cin >> N;
  REP(i, N) cin >> A[i];
  cin >> M;
  REP(i, M) cin >> B[i];
  sort(A, A + N);
  sort(B, B + M);
  int64_t a = 0, b = 0, mx = -1e8;
  REP(k, N) {
    int64_t i = lower_bound(A, A + N, A[k]) - A;
    int64_t j = lower_bound(B, B + M, A[k]) - B;
    int64_t x = (N - i) * 3 + i * 2;
    int64_t y = (M - j) * 3 + j * 2;

    if (x - y > mx) {
      mx = x - y;
      a = x;
      b = y;
    } else if (x - y == mx) {
      if (a > x) {
        a = x;
        b = y;
      }
    }
  }
  REP(k, M) {
    int64_t i = lower_bound(A, A + N, B[k]) - A;
    int64_t j = lower_bound(B, B + M, B[k]) - B;
    int64_t x = (N - i) * 3 + i * 2;
    int64_t y = (M - j) * 3 + j * 2;

    if (x - y > mx) {
      mx = x - y;
      a = x;
      b = y;
    } else if (x - y == mx) {
      if (a > x) {
        a = x;
        b = y;
      }
    }
  }
  int64_t i = lower_bound(A, A + N, B[M - 1] + 1) - A;
  int64_t j = lower_bound(B, B + M, B[M - 1] + 1) - B;
  int64_t x = (N - i) * 3 + i * 2;
  int64_t y = (M - j) * 3 + j * 2;

  if (x - y > mx) {
    mx = x - y;
    a = x;
    b = y;
  } else if (x - y == mx) {
    if (a > x) {
      a = x;
      b = y;
    }
  }

  i = lower_bound(A, A + N, A[N - 1]) - A;
  j = lower_bound(B, B + M, A[N - 1]) - B;
  x = (N - i) * 3 + i * 2;
  y = (M - j) * 3 + j * 2;

  if (x - y > mx) {
    mx = x - y;
    a = x;
    b = y;
  } else if (x - y == mx) {
    if (a > x) {
      a = x;
      b = y;
    }
  }

  cout << a << ":" << b;
  return 0;
}


// Written by Na2a

#include <bits/stdc++.h>

#define llong long long

#define pb push_back
#define mp make_pair

#define F first
#define S second

using namespace std;

const int INF = (int) 1e9 + 7;
const int MXN = (int) 1e5 + 7;

const double EPS = (double) 1e-9;

int n, m, s1, s2;
int a[MXN], b[MXN];

int main() {
	#define FNAME ""

	#ifdef LOCAL
	freopen(FNAME".in", "r", stdin);
	freopen(FNAME".out", "w", stdout);
	#endif

	scanf("%d", &n);
	for (int i = 0; i < n; i++)
		scanf("%d", &a[i]);

   	scanf("%d", &m);
   	for (int i = 0; i < m; i++)
   		scanf("%d", &b[i]);

    s1 = n + n;
    s2 = m + m;
    int ax = 0, ay = 0, ans = s1 - s2;
    for (int i = 0; i <= n; i++) {
    	int cur = a[i];
    	int add1 = n - (upper_bound(a, a + n, cur) - a);
    	int add2 = m - (upper_bound(b, b + m, cur) - b);
    	//cout<<add1<<' '<<add2<<endl;
    	if (s1 + add1 - s2 - add2 > ans || (s1 + add1 - s2 - add2 == ans && s1 + add1 > s1 + ax)) {
    		ans = s1 + add1 - s2 - add2;
    		ax = add1, ay = add2;
    	}
    }
    for (int i = 0; i <= m; i++) {
    	int cur = b[i];
    	int add1 = n - (upper_bound(a, a + n, cur) - a);
    	int add2 = m - (upper_bound(b, b + m, cur) - b);
    	//cout<<add1<<' '<<add2<<endl;
    	if (s1 + add1 - s2 - add2 > ans || (s1 + add1 - s2 - add2 == ans && s1 + add1 > s1 + ax)) {
    		ans = s1 + add1 - s2 - add2;
    		ax = add1, ay = add2;
    	}
    }
    printf("%d:%d", s1 + ax, s2 + ay);
	return 0;
}


// Written by Na2a

#include <bits/stdc++.h>

#define llong long long

#define pb push_back
#define mp make_pair

#define F first
#define S second

using namespace std;

const int INF = (int) 1e9 + 7;
const int MXN = (int) 3e5 + 7;

const double EPS = (double) 1e-9;

int n, m, s1, s2;
int a[MXN], b[MXN];

vector<int> v;

int main() {
    #define FNAME ""

    #ifdef LOCAL
    freopen(FNAME".in", "r", stdin);
    freopen(FNAME".out", "w", stdout);
    #endif

    scanf("%d", &n);
    for (int i = 0; i < n; i++)
        scanf("%d", &a[i]);

    scanf("%d", &m);
    for (int i = 0; i < m; i++)
        scanf("%d", &b[i]);

    sort(a, a + n);
    sort(b, b + m);

    for (int i = 0; i < n; i++) v.pb(a[i]), v.pb(a[i] - 1);
    for (int i = 0; i < m; i++) v.pb(b[i]), v.pb(b[i] - 1);

    s1 = n + n;
    s2 = m + m;
    int ax = 0, ay = 0, ans = s1 - s2;
    for (int i = 0; i < v.size(); i++) {
        int cur = v[i];
        int add1 = n - (upper_bound(a, a + n, cur) - a);
        int add2 = m - (upper_bound(b, b + m, cur) - b);
        if (s1 + add1 - s2 - add2 > ans || (s1 + add1 - s2 - add2 == ans && s1 + add1 > s1 + ax)) {
            ans = s1 + add1 - s2 - add2;
            ax = add1, ay = add2;
        }
    }
    printf("%d:%d", s1 + ax, s2 + ay);
    return 0;
}


// Written by Na2a

#include <bits/stdc++.h>

#define llong long long

#define pb push_back
#define mp make_pair

#define F first
#define S second

using namespace std;

const int INF = (int) 1e9 + 7;
const int MXN = (int) 3e5 + 7;

const double EPS = (double) 1e-9;

int n, m, s1, s2;
int a[MXN], b[MXN];

int main() {
	#define FNAME ""

	#ifdef LOCAL
	freopen(FNAME".in", "r", stdin);
	freopen(FNAME".out", "w", stdout);
	#endif

	scanf("%d", &n);
	for (int i = 0; i < n; i++)
		scanf("%d", &a[i]);

   	scanf("%d", &m);
   	for (int i = 0; i < m; i++)
   		scanf("%d", &b[i]);

    s1 = n + n;
    s2 = m + m;
    int ax = 0, ay = 0, ans = s1 - s2;
    for (int i = 0; i <= n; i++) {
    	int cur = a[i];
    	int add1 = n - (upper_bound(a, a + n, cur) - a);
    	int add2 = m - (upper_bound(b, b + m, cur) - b);
    	//cout<<add1<<' '<<add2<<endl;
    	if (s1 + add1 - s2 - add2 > ans || (s1 + add1 - s2 - add2 == ans && s1 + add1 > s1 + ax)) {
    		ans = s1 + add1 - s2 - add2;
    		ax = add1, ay = add2;
    	}
    }
for (int i = 0; i <= n; i++) {
    	int cur = a[i] - 1;
    	int add1 = n - (upper_bound(a, a + n, cur) - a);
    	int add2 = m - (upper_bound(b, b + m, cur) - b);
    	//cout<<add1<<' '<<add2<<endl;
    	if (s1 + add1 - s2 - add2 > ans || (s1 + add1 - s2 - add2 == ans && s1 + add1 > s1 + ax)) {
    		ans = s1 + add1 - s2 - add2;
    		ax = add1, ay = add2;
    	}
    }
    for (int i = 0; i <= m; i++) {
    	int cur = b[i];
    	int add1 = n - (upper_bound(a, a + n, cur) - a);
    	int add2 = m - (upper_bound(b, b + m, cur) - b);
    	//cout<<add1<<' '<<add2<<endl;
    	if (s1 + add1 - s2 - add2 > ans || (s1 + add1 - s2 - add2 == ans && s1 + add1 > s1 + ax)) {
    		ans = s1 + add1 - s2 - add2;
    		ax = add1, ay = add2;
    	}
    }
for (int i = 0; i <= m; i++) {
    	int cur = b[i]-1;
    	int add1 = n - (upper_bound(a, a + n, cur) - a);
    	int add2 = m - (upper_bound(b, b + m, cur) - b);
    	//cout<<add1<<' '<<add2<<endl;
    	if (s1 + add1 - s2 - add2 > ans || (s1 + add1 - s2 - add2 == ans && s1 + add1 > s1 + ax)) {
    		ans = s1 + add1 - s2 - add2;
    		ax = add1, ay = add2;
    	}
    }
    printf("%d:%d", s1 + ax, s2 + ay);
	return 0;
}


// Written by Na2a

#include <bits/stdc++.h>

#define llong long long

#define pb push_back
#define mp make_pair

#define F first
#define S second

using namespace std;

const int INF = (int) 1e9 + 7;
const int MXN = (int) 1e5 + 7;

const double EPS = (double) 1e-9;

int n, m, s1, s2;
int a[MXN], b[MXN];

int main() {
	#define FNAME ""

	#ifdef LOCAL
	freopen(FNAME".in", "r", stdin);
	freopen(FNAME".out", "w", stdout);
	#endif

	scanf("%d", &n);
	for (int i = 0; i < n; i++)
		scanf("%d", &a[i]);

   	scanf("%d", &m);
   	for (int i = 0; i < m; i++)
   		scanf("%d", &b[i]);

    s1 = n + n;
    s2 = m + m;
    int ax = 0, ay = 0, ans = s1 - s2;
    for (int i = 0; i <= n; i++) {
    	int cur = a[i];
    	int add1 = n - (upper_bound(a, a + n, cur) - a);
    	int add2 = m - (upper_bound(b, b + m, cur) - b);
    	//cout<<add1<<' '<<add2<<endl;
    	if (s1 + add1 - s2 - add2 > ans || (s1 + add1 - s2 - add2 == ans && s1 + add1 > s1 + ax)) {
    		ans = s1 + add1 - s2 - add2;
    		ax = add1, ay = add2;
    	}
    }
for (int i = 0; i <= n; i++) {
    	int cur = a[i] - 1;
    	int add1 = n - (upper_bound(a, a + n, cur) - a);
    	int add2 = m - (upper_bound(b, b + m, cur) - b);
    	//cout<<add1<<' '<<add2<<endl;
    	if (s1 + add1 - s2 - add2 > ans || (s1 + add1 - s2 - add2 == ans && s1 + add1 > s1 + ax)) {
    		ans = s1 + add1 - s2 - add2;
    		ax = add1, ay = add2;
    	}
    }
    for (int i = 0; i <= m; i++) {
    	int cur = b[i];
    	int add1 = n - (upper_bound(a, a + n, cur) - a);
    	int add2 = m - (upper_bound(b, b + m, cur) - b);
    	//cout<<add1<<' '<<add2<<endl;
    	if (s1 + add1 - s2 - add2 > ans || (s1 + add1 - s2 - add2 == ans && s1 + add1 > s1 + ax)) {
    		ans = s1 + add1 - s2 - add2;
    		ax = add1, ay = add2;
    	}
    }
for (int i = 0; i <= m; i++) {
    	int cur = b[i]-1;
    	int add1 = n - (upper_bound(a, a + n, cur) - a);
    	int add2 = m - (upper_bound(b, b + m, cur) - b);
    	//cout<<add1<<' '<<add2<<endl;
    	if (s1 + add1 - s2 - add2 > ans || (s1 + add1 - s2 - add2 == ans && s1 + add1 > s1 + ax)) {
    		ans = s1 + add1 - s2 - add2;
    		ax = add1, ay = add2;
    	}
    }
    printf("%d:%d", s1 + ax, s2 + ay);
	return 0;
}


#include <iostream>
#include <cstring>

using namespace std;

int a[200000];
int b[200000];
int tmp[200000];

void merge(int l, int r, int x[])
{
	int m = (l + r)/2;
	int pl = l;
	int pr = m + 1;
	for (int i = l ; i <= r ; i++)
	{
		if (pl > m)
		{
			tmp[i] = x[pr];
			pr++;
			continue;
		}
		if (pr > r)
		{
			tmp[i] = x[pl];
			pl++;
			continue;
		}
		if (x[pl] < x[pr])
		{
			tmp[i] = x[pl];
			pl++;
			continue;
		}
		else
		{
			tmp[i] = x[pr];
			pr++;
		}
	}
	for (int i = l ; i <= r; i++)
	{
		x[i] = tmp[i];
	}
}

void sort(int l, int r, int x[])
{
	if (l == r)
	{
		return;
	}
	int m = (l + r)/2;
	sort(l, m, x);
	sort(m + 1, r, x);
	merge(l, r, x);
}

int search(int v, int x[], int r, int l)
{
	while (r < l)
	{
		int m = (r + l)/2;
		if (v > x[m])
		{
			r = m + 1;
		}
		else
		{
			l = m;
		}
	}
	if (x[l] < v)
	{
		return l + 1;
	}
	return l;
}

int main(){
	int na=0,nb=0;
	cin >> na;
	memset(a, 0, sizeof(a));
	memset(b, 0, sizeof(b));
	memset(tmp, 0, sizeof(tmp));
	for (int i = 0 ; i < na ; i++)
	{
		cin >> a[i];
	}
	cin >> nb;
	for (int i = 0 ; i < nb ; i++)
	{
		cin >> b[i];
	}
	sort(0, na - 1, a);
	sort(0, nb - 1, b);
	int maxa = 2 * na;
	int maxb = 2 * nb;
	int max = maxa - maxb;
	for (int i = 0 ; i < na ; i++)
	{
		int index = search(a[i], a, 0 , na - 1);
		int sa = 2 * index + (na - index) * 3;
		index = search(a[i], b, 0 , nb - 1);
		int sb = 2 * index + (nb - index) * 3;
		//cout << sa << ' ' << sb << endl;
		if (max < sa - sb || (max == sa - sb && sa > maxa))
		{
			max = sa - sb;
			maxa = sa;
			maxb = sb;
		}
	}
	cout << maxa << ':' << maxb << endl;
	return 0;
}


#include <iostream>
#include <cstring>

using namespace std;

int a[200000];
int b[200000];
int tmp[200000];

void merge(int l, int r, int x[])
{
	int m = (l + r)/2;
	int pl = l;
	int pr = m + 1;
	for (int i = l ; i <= r ; i++)
	{
		if (pl > m)
		{
			tmp[i] = x[pr];
			pr++;
			continue;
		}
		if (pr > r)
		{
			tmp[i] = x[pl];
			pl++;
			continue;
		}
		if (x[pl] < x[pr])
		{
			tmp[i] = x[pl];
			pl++;
			continue;
		}
		else
		{
			tmp[i] = x[pr];
			pr++;
		}
	}
	for (int i = l ; i <= r; i++)
	{
		x[i] = tmp[i];
	}
}

void sort(int l, int r, int x[])
{
	if (l == r)
	{
		return;
	}
	int m = (l + r)/2;
	sort(l, m, x);
	sort(m + 1, r, x);
	merge(l, r, x);
}

int search(int v, int x[], int r, int l)
{
	while (r < l)
	{
		int m = (r + l)/2;
		if (v > x[m])
		{
			r = m + 1;
		}
		else
		{
			l = m;
		}
	}
	if (x[l] < v)
	{
		return l + 1;
	}
	return l;
}

int main(){
	int na=0,nb=0;
	cin >> na;
	memset(a, 0, sizeof(a));
	memset(b, 0, sizeof(b));
	memset(tmp, 0, sizeof(tmp));
	for (int i = 0 ; i < na ; i++)
	{
		cin >> a[i];
	}
	cin >> nb;
	for (int i = 0 ; i < nb ; i++)
	{
		cin >> b[i];
	}
	sort(0, na - 1, a);
	sort(0, nb - 1, b);
	int maxa = 2 * na;
	int maxb = 2 * nb;
	int max = maxa - maxb;
	for (int i = 0 ; i < na ; i++)
	{
		int index = search(a[i], a, 0 , na - 1);
		int sa = 2 * index + (na - index) * 3;
		index = search(a[i], b, 0 , nb - 1);
		int sb = 2 * index + (nb - index) * 3;
		//cout << sa << ' ' << sb << endl;
		if (max < sa - sb)
		{
			max = sa - sb;
			maxa = sa;
			maxb = sb;
		}
	}
	cout << maxa << ':' << maxb << endl;
	return 0;
}


#include <iostream>
#include <cstring>

using namespace std;

int a[200000];
int b[200000];
int tmp[200000];

void merge(int l, int r, int x[])
{
	int m = (l + r)/2;
	int pl = l;
	int pr = m + 1;
	for (int i = l ; i <= r ; i++)
	{
		if (pl > m)
		{
			tmp[i] = x[pr];
			pr++;
			continue;
		}
		if (pr > r)
		{
			tmp[i] = x[pl];
			pl++;
			continue;
		}
		if (x[pl] < x[pr])
		{
			tmp[i] = x[pl];
			pl++;
			continue;
		}
		else
		{
			tmp[i] = x[pr];
			pr++;
		}
	}
	for (int i = l ; i <= r; i++)
	{
		x[i] = tmp[i];
	}
}

void sort(int l, int r, int x[])
{
	if (l == r)
	{
		return;
	}
	int m = (l + r)/2;
	sort(l, m, x);
	sort(m + 1, r, x);
	merge(l, r, x);
}

int search(int v, int x[], int r, int l)
{
	while (r < l)
	{
		int m = (r + l)/2;
		if (v > x[m])
		{
			r = m + 1;
		}
		else
		{
			l = m;
		}
	}
	if (x[l] < v)
	{
		return l + 1;
	}
	return l;
}

int main(){
	int na=0,nb=0;
	cin >> na;
	memset(a, 0, sizeof(a));
	memset(b, 0, sizeof(b));
	memset(tmp, 0, sizeof(tmp));
	for (int i = 0 ; i < na ; i++)
	{
		cin >> a[i];
	}
	cin >> nb;
	for (int i = 0 ; i < nb ; i++)
	{
		cin >> b[i];
	}
	sort(0, na - 1, a);
	sort(0, nb - 1, b);
	int maxa = 0;
	int maxb = 0;
	int max = -10000000;
	for (int i = 0 ; i < na ; i++)
	{
		int index = search(a[i], a, 0 , na - 1);
		int sa = 2 * index + (na - index) * 3;
		index = search(a[i], b, 0 , nb - 1);
		int sb = 2 * index + (nb - index) * 3;
		//cout << sa << ' ' << sb << endl;
		if (max < sa - sb)
		{
			max = sa - sb;
			maxa = sa;
			maxb = sb;
		}
	}
	cout << maxa << ':' << maxb << endl;
	return 0;
}


#include <iostream>
#include <cstring>

using namespace std;

int a[200000];
int b[200000];
int tmp[200000];

void merge(int l, int r, int x[])
{
	int m = (l + r)/2;
	int pl = l;
	int pr = m + 1;
	for (int i = l ; i <= r ; i++)
	{
		if (pl > m)
		{
			tmp[i] = x[pr];
			pr++;
			continue;
		}
		if (pr > r)
		{
			tmp[i] = x[pl];
			pl++;
			continue;
		}
		if (x[pl] < x[pr])
		{
			tmp[i] = x[pl];
			pl++;
			continue;
		}
		else
		{
			tmp[i] = x[pr];
			pr++;
		}
	}
	for (int i = l ; i <= r; i++)
	{
		x[i] = tmp[i];
	}
}

void sort(int l, int r, int x[])
{
	if (l == r)
	{
		return;
	}
	int m = (l + r)/2;
	sort(l, m, x);
	sort(m + 1, r, x);
	merge(l, r, x);
}

int search(int v, int x[], int r, int l)
{
	while (r < l)
	{
		int m = (r + l)/2;
		if (v > x[m])
		{
			r = m + 1;
		}
		else
		{
			l = m;
		}
	}
	return l;
}

int main(){
	int na=0,nb=0;
	cin >> na;
	memset(a, 0, sizeof(a));
	memset(b, 0, sizeof(b));
	memset(tmp, 0, sizeof(tmp));
	for (int i = 0 ; i < na ; i++)
	{
		cin >> a[i];
	}
	cin >> nb;
	for (int i = 0 ; i < nb ; i++)
	{
		cin >> b[i];
	}
	sort(0, na - 1, a);
	sort(0, nb - 1, b);
	int maxa = 0;
	int maxb = 0;
	int max = -10000000;
	for (int i = 0 ; i < na ; i++)
	{
		int index = search(a[i], a, 0 , na - 1);
		int sa = 2 * index + (na - index) * 3;
		index = search(a[i], b, 0 , nb - 1);
		int sb = 2 * index + (nb - index) * 3;
		if (max < sa - sb)
		{
			max = sa - sb;
			maxa = sa;
			maxb = sb;
		}
	}
	cout << maxa << ':' << maxb << endl;
	return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main() {
    int n, m;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }
    cin >> m;
    vector<int> b(m);
    for (int i = 0; i < m; ++i) {
        cin >> b[i];
    }
    sort(a.begin(), a.end());
    sort(b.begin(), b.end());

    vector<int> apos(m + n), bpos(m + n);
    int i = 0, j = 0, k = 0;
    while (i < a.size() && j < b.size()) {
        if (a[i] < b[j]) {
            if (k == 0) {
                apos[k] = 1;
                bpos[k] = 0;
            } else {
                apos[k] = 1 + apos[k - 1];
                bpos[k] = bpos[k - 1];
            }
            ++i; ++k;
        } else if (a[i] > b[j]) {
            if (k == 0) {
                apos[k] = 0;
                bpos[k] = 1;
            } else {
                apos[k] = apos[k - 1];
                bpos[k] = 1 + bpos[k - 1];
            }
            ++j; ++k;
        } else {
            while (a[i] == b[j] && i < a.size() && j < b.size()) {
                if (k == 0) {
                    apos[k] = bpos[k] = 1;
                } else {
                    apos[k] = 1 + apos[k - 1];
                    bpos[k] = 1 + bpos[k - 1];
                }
                ++i; ++j; ++k;
            }
        }
    }
    while (i < a.size()) {
        apos[k] = 1 + apos[k - 1];
        bpos[k] = bpos[k - 1];
        ++i; ++k;
    }
    while (j < b.size()) {
        apos[k] = apos[k - 1];
        bpos[k] = 1 + bpos[k - 1];
        ++j; ++k;
    }

    apos.push_back(apos.back());
    for (int i = apos.size() - 2; i > 0; --i) {
        apos[i] = apos[i - 1];
    }
    apos[0] = 0;
    bpos.push_back(bpos.back());
    for (int i = bpos.size() - 2; i > 0; --i) {
        bpos[i] = bpos[i - 1];
    }
    bpos[0] = 0;

    long long besta = -500000000, bestb = 500000000;
    for (int i = 0; i < n + m + 1; ++i) {
        long long currenta = 2LL * apos[i] + 3LL * (a.size() - apos[i]);
        long long currentb = 2LL * bpos[i] + 3LL * (b.size() - bpos[i]);
        if (currenta - currentb > besta - bestb || (currenta - currentb == besta - bestb
                && currenta > besta)) {
            besta = currenta;
            bestb = currentb;
        }
    }
    cout << besta << ":" << bestb;
    return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main() {
    int n, m;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }
    cin >> m;
    vector<int> b(m);
    for (int i = 0; i < m; ++i) {
        cin >> b[i];
    }
    sort(a.begin(), a.end());
    sort(b.begin(), b.end());

    vector<int> apos(m + n), bpos(m + n);
    int i = 0, j = 0, k = 0;
    while (i < a.size() && j < b.size()) {
        if (a[i] < b[j]) {
            if (k == 0) {
                apos[k] = 1;
                bpos[k] = 0;
            } else {
                apos[k] = 1 + apos[k - 1];
                bpos[k] = bpos[k - 1];
            }
            ++i; ++k;
        } else if (a[i] > b[j]) {
            if (k == 0) {
                apos[k] = 0;
                bpos[k] = 1;
            } else {
                apos[k] = apos[k - 1];
                bpos[k] = 1 + bpos[k - 1];
            }
            ++j; ++k;
        } else {
            while (a[i] == b[j]) {
                if (k == 0) {
                    apos[k] = bpos[k] = 1;
                } else {
                    apos[k] = 1 + apos[k - 1];
                    bpos[k] = 1 + bpos[k - 1];
                }
                ++i; ++j; ++k;
            }
        }
    }
    while (i < a.size()) {
        apos[k] = 1 + apos[k - 1];
        bpos[k] = bpos[k - 1];
        ++i; ++k;
    }
    while (j < b.size()) {
        apos[k] = apos[k - 1];
        bpos[k] = 1 + bpos[k - 1];
        ++j; ++k;
    }

    apos.push_back(apos.back());
    for (int i = apos.size() - 2; i > 0; --i) {
        apos[i] = apos[i - 1];
    }
    apos[0] = 0;
    bpos.push_back(bpos.back());
    for (int i = bpos.size() - 2; i > 0; --i) {
        bpos[i] = bpos[i - 1];
    }
    bpos[0] = 0;

    int besta = -500000000, bestb = 500000000;
    for (int i = 0; i < n + m + 1; ++i) {
        int currenta = 2 * apos[i] + 3 * (a.size() - apos[i]);
        int currentb = 2 * bpos[i] + 3 * (b.size() - bpos[i]);
        if (currenta - currentb > besta - bestb || (currenta - currentb == besta - bestb
                && currenta > besta)) {
            besta = currenta;
            bestb = currentb;
        }
    }
    cout << besta << ":" << bestb;
    return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main() {
    int n, m;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }
    cin >> m;
    vector<int> b(m);
    for (int i = 0; i < m; ++i) {
        cin >> b[i];
    }
    sort(a.begin(), a.end());
    sort(b.begin(), b.end());

    vector<int> apos(m + n), bpos(m + n);
    int i = 0, j = 0, k = 0;
    while (i < a.size() && j < b.size()) {
        if (a[i] < b[j]) {
            if (k == 0) {
                apos[k] = 1;
                bpos[k] = 0;
            } else {
                apos[k] = 1 + apos[k - 1];
                bpos[k] = bpos[k - 1];
            }
            ++i; ++k;
        } else if (a[i] > b[j]) {
            if (k == 0) {
                apos[k] = 0;
                bpos[k] = 1;
            } else {
                apos[k] = apos[k - 1];
                bpos[k] = 1 + bpos[k - 1];
            }
            ++j; ++k;
        } else {
            while (a[i] == b[j] && i < a.size() && j < b.size()) {
                if (k == 0) {
                    apos[k] = bpos[k] = 1;
                } else {
                    apos[k] = 1 + apos[k - 1];
                    bpos[k] = 1 + bpos[k - 1];
                }
                ++i; ++j; ++k;
            }
        }
    }
    while (i < a.size()) {
        apos[k] = 1 + apos[k - 1];
        bpos[k] = bpos[k - 1];
        ++i; ++k;
    }
    while (j < b.size()) {
        apos[k] = apos[k - 1];
        bpos[k] = 1 + bpos[k - 1];
        ++j; ++k;
    }

    apos.push_back(apos.back());
    for (int i = apos.size() - 2; i > 0; --i) {
        apos[i] = apos[i - 1];
    }
    apos[0] = 0;
    bpos.push_back(bpos.back());
    for (int i = bpos.size() - 2; i > 0; --i) {
        bpos[i] = bpos[i - 1];
    }
    bpos[0] = 0;

    int besta = -500000000, bestb = 500000000;
    for (int i = 0; i < n + m + 1; ++i) {
        int currenta = 2 * apos[i] + 3 * (a.size() - apos[i]);
        int currentb = 2 * bpos[i] + 3 * (b.size() - bpos[i]);
        if (currenta - currentb > besta - bestb || (currenta - currentb == besta - bestb
                && currenta > besta)) {
            besta = currenta;
            bestb = currentb;
        }
    }
    cout << besta << ":" << bestb;
    return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main() {
    int n, m;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }
    cin >> m;
    vector<int> b(m);
    for (int i = 0; i < m; ++i) {
        cin >> b[i];
    }
    sort(a.begin(), a.end());
    sort(b.begin(), b.end());

    vector<int> apos(m + n), bpos(m + n), c(m + n);
    int i = 0, j = 0, k = 0;
    while (i < a.size() && j < b.size()) {
        if (a[i] < b[j]) {
            c[k] = a[i];
            if (k == 0) {
                apos[k] = 1;
                bpos[k] = 0;
            } else {
                apos[k] = 1 + apos[k - 1];
                bpos[k] = bpos[k - 1];
            }
            ++i;
        } else if (a[i] > b[j]) {
            c[k] = b[j];
            if (k == 0) {
                apos[k] = 0;
                bpos[k] = 1;
            } else {
                apos[k] = apos[k - 1];
                bpos[k] = 1 + bpos[k - 1];
            }
            ++j;
        } else {
            c[k] = a[i];
            if (k == 0) {
                apos[k] = bpos[k] = 1;
            } else {
                apos[k] = 1 + apos[k - 1];
                bpos[k] = 1 + bpos[k - 1];
            }
            ++k;
            c[k] = b[j];
            apos[k] = 1 + apos[k - 1];
            bpos[k] = 1 + bpos[k - 1];
            ++i; ++j;
        }
        ++k;
    }
    while (i < a.size()) {
        c[k] = a[i];
        apos[k] = 1 + apos[k - 1];
        bpos[k] = bpos[k - 1];
        ++i; ++k;
    }
    while (j < b.size()) {
        c[k] = b[j];
        apos[k] = apos[k - 1];
        bpos[k] = 1 + bpos[k - 1];
        ++j; ++k;
    }

    apos.push_back(apos.back());
    for (int i = apos.size() - 2; i > 0; --i) {
        apos[i] = apos[i - 1];
    }
    apos[0] = 0;
    bpos.push_back(bpos.back());
    for (int i = bpos.size() - 2; i > 0; --i) {
        bpos[i] = bpos[i - 1];
    }
    bpos[0] = 0;

    int besta = 0, bestb = 0;
    for (int i = 0; i < n + m + 1; ++i) {
        int currenta = 2 * apos[i] + 3 * (a.size() - apos[i]);
        int currentb = 2 * bpos[i] + 3 * (b.size() - bpos[i]);
        if (currenta - currentb > besta - bestb || (currenta - currentb == besta - bestb
                && currenta > besta)) {
            besta = currenta;
            bestb = currentb;
        }
    }
    cout << besta << ":" << bestb;
    return 0;
}


//template igorjan94 version from 24 November 2014
#include <bits/stdc++.h>

#define pb push_back
#define ll long long
#define forit(it, r) for (auto it = r.begin(); it != r.end(); it++)
#define forn(i, n) for (int i = 0; i < n; ++i)
#define forn1(i, n) for (int i = 1; i < n; ++i)
#define FOR(i, m, n) for (int i = m; i < n; ++i)
#define ROF(i, m, n) for (int i = m; i >= n; --i)
#define fori(n) for (int i = 0; i < n; ++i)
#define forj(n) for (int j = 0; j < n; ++j)
#define fori1(n) for (int i = 1; i < n; ++i)
#define forj1(n) for (int j = 1; j < n; ++j)
#define vi vector<int>
#define vvi vector<vector<int> >
#define vll vector<long long>
#define pii pair<int, int>
#define pll pair<ll, ll>
#define whole(a) a.begin(), a.end()
#define fst first
#define cnd second

#ifndef ONLINE_JUDGE
#define lld I64d
#endif

#define FILENAME "input"
#define INF 1000000007
#define DOUBLEFORMAT "%f"

using namespace std;

template <class Head, class... Tail> inline void writeln(Head head, Tail... tail);
template <class Head, class... Tail> inline void writeln2(Head head, Tail... tail);
template <class Head, class... Tail> inline void readln(Head& head, Tail&... tail);
template <class Head, class... Tail> inline void read(Head& head, Tail&... tail);
template <class Head, class... Tail> inline void print(Head& head, Tail&... tail);
template <class Type1, class Type2>  inline void print(pair<Type1, Type2>& p);
template <class Type1, class Type2>  inline void print_no_space(pair<Type1, Type2>& p);
template <class Head, class... Tail> inline void print_no_space(Head& head, Tail&... tail);
void inline writeln(){printf("\n");}void inline writeln2(){printf("\n");}void inline readln(){}

///----------------------------------------------------------------------------------------------------------------------------

void run()
{
    vi a, b;
    set<int> A;
    readln(a, b);
    sort(whole(a));
    sort(whole(b));
    int n = a.size();
    int m = b.size();
    A.insert(0);
    A.insert(INF * 2);
    fori(n)
        A.insert(a[i]);
    fori(m)
        A.insert(b[i]);
    ll sum1 = 0, sum2 = 0, mx = 0;
    pll ans;
    forit(i, A)
    {
        ll j = upper_bound(whole(a), *i) - a.begin();
        sum1 = j * 2 + 1ll * (a.size() - j) * 3;
        ll k = upper_bound(whole(b), *i) - b.begin();
        sum2 = k * 2 + 1ll * (b.size() - k) * 3;
        if (sum1 - sum2 > mx)
            mx = sum1 - sum2,
            ans = {sum1, sum2};
        else
            if (sum1 - sum2 == mx)
                if (sum1 > ans.first)
                    ans = {sum1, sum2};
    }
    cout << ans.first << ":" << ans.second << "\n";
}

int main()
{
//    freopen(FILENAME".in", "r", stdin);
//    freopen(FILENAME".out", "w", stdout);
    run();
    return 0;
}

inline void print(double a){printf(" " DOUBLEFORMAT,a);}
inline void print(int a){printf(" %d",a);}
inline void print(const char* a){printf(" %s",a);}
inline void print(string a){printf(" %s",a.c_str());}
inline void print(long long a){printf(" %lld",a);}
inline void print(unsigned long a){printf(" %ld",a);}
inline void print(unsigned int a){printf(" %d",a);}
inline void print(char a){printf(" %c",a);}
inline void print_no_space(double a){printf(DOUBLEFORMAT, a);}
inline void print_no_space(int a){printf("%d", a);}
inline void print_no_space(const char* a){printf("%s", a);}
inline void print_no_space(string a){printf("%s", a.c_str());}
inline void print_no_space(long long a){printf("%lld", a);}
inline void print_no_space(unsigned long a){printf("%ld", a);}
inline void print_no_space(unsigned int a){printf("%d", a);}
inline void print_no_space(char a){printf("%c", a);}

template<class Type> inline void print(vector<Type>& a){for(int i=0;i<a.size();++i)print(a[i]);}
template<class Type> inline void print(vector<vector<Type> >& a){if(a.size())(a.size()==1)?print(a[0]):writeln2(a[0]);for(int i=1;i<a.size()-1;++i)writeln2(a[i]);if(a.size()>=2)print_no_space(a.back());}
template<class Type> inline void print_no_space(vector<Type>& a){if(a.size())print_no_space(a[0]);for(int i=1;i<a.size();++i)print(a[i]);}
template<class Type> inline void print_no_space(vector<vector<Type> >&a){for(int i=0;i<a.size()-1;++i)writeln(a[i]);if(a.size())print_no_space(a.back());}

template<class Type1, class Type2> inline void print_no_space(pair<Type1, Type2>&a){print_no_space(a.first); writeln2(a.second);}
template<class Type1, class Type2> inline void print(pair<Type1, Type2>& a)        {print_no_space(a.first); writeln2(a.second);}

template <class Head, class... Tail> inline void writeln2(Head head, Tail... tail){print(head);writeln2(tail...);}
template <class Head, class... Tail> inline void writeln(Head head, Tail... tail){print_no_space(head);writeln2(tail...);}

inline void read(double &a){scanf("%lf",&a);}
inline void read(int &a){scanf("%d",&a);}
inline void read(string &a){cin>>a;}
inline void read(long long &a){scanf("%lld",&a);}
inline void read(char &a){scanf("%c",&a);}
template<class Type1, class Type2> inline void read(pair<Type1, Type2>&a){readln(a.first, a.second);}
template<class Type> inline void read(vector<Type> &a){if(a.size()==0){int n;read(n);a.resize(n);}for(int i=0;i<a.size();++i)readln(a[i]);}
template <class Head,class... Tail> inline void readln(Head& head,Tail&... tail){read(head);readln(tail...);}


//template igorjan94 version from 24 November 2014
#include <bits/stdc++.h>

#define pb push_back
#define ll long long
#define forit(it, r) for (auto it = r.begin(); it != r.end(); it++)
#define forn(i, n) for (int i = 0; i < n; ++i)
#define forn1(i, n) for (int i = 1; i < n; ++i)
#define FOR(i, m, n) for (int i = m; i < n; ++i)
#define ROF(i, m, n) for (int i = m; i >= n; --i)
#define fori(n) for (int i = 0; i < n; ++i)
#define forj(n) for (int j = 0; j < n; ++j)
#define fori1(n) for (int i = 1; i < n; ++i)
#define forj1(n) for (int j = 1; j < n; ++j)
#define vi vector<int>
#define vvi vector<vector<int> >
#define vll vector<long long>
#define pii pair<int, int>
#define pll pair<ll, ll>
#define whole(a) a.begin(), a.end()
#define fst first
#define cnd second

#ifndef ONLINE_JUDGE
#define lld I64d
#endif

#define FILENAME "input"
#define INF 1000000007
#define DOUBLEFORMAT "%f"

using namespace std;

template <class Head, class... Tail> inline void writeln(Head head, Tail... tail);
template <class Head, class... Tail> inline void writeln2(Head head, Tail... tail);
template <class Head, class... Tail> inline void readln(Head& head, Tail&... tail);
template <class Head, class... Tail> inline void read(Head& head, Tail&... tail);
template <class Head, class... Tail> inline void print(Head& head, Tail&... tail);
template <class Type1, class Type2>  inline void print(pair<Type1, Type2>& p);
template <class Type1, class Type2>  inline void print_no_space(pair<Type1, Type2>& p);
template <class Head, class... Tail> inline void print_no_space(Head& head, Tail&... tail);
void inline writeln(){printf("\n");}void inline writeln2(){printf("\n");}void inline readln(){}

///----------------------------------------------------------------------------------------------------------------------------

void run()
{
    vi a, b;
    set<int> A;
    readln(a, b);
    sort(whole(a));
    sort(whole(b));
    int n = a.size();
    int m = b.size();
    A.insert(0);
    A.insert(INF);
    fori(n)
        A.insert(a[i]);
    fori(m)
        A.insert(b[i]);
    ll sum1 = 0, sum2 = 0, mx = 0;
    pll ans;
    forit(i, A)
    {
        ll j = upper_bound(whole(a), *i) - a.begin();
        sum1 = j * 2 + 1ll * (a.size() - j) * 3;
        ll k = upper_bound(whole(b), *i) - b.begin();
        sum2 = k * 2 + 1ll * (b.size() - k) * 3;
        if (sum1 - sum2 >= mx)
            mx = sum1 - sum2,
            ans = {sum1, sum2};
    }
    printf("%lld:%lld\n", ans.first, ans.second);
}

int main()
{
//    freopen(FILENAME".in", "r", stdin);
//    freopen(FILENAME".out", "w", stdout);
    run();
    return 0;
}

inline void print(double a){printf(" " DOUBLEFORMAT,a);}
inline void print(int a){printf(" %d",a);}
inline void print(const char* a){printf(" %s",a);}
inline void print(string a){printf(" %s",a.c_str());}
inline void print(long long a){printf(" %lld",a);}
inline void print(unsigned long a){printf(" %ld",a);}
inline void print(unsigned int a){printf(" %d",a);}
inline void print(char a){printf(" %c",a);}
inline void print_no_space(double a){printf(DOUBLEFORMAT, a);}
inline void print_no_space(int a){printf("%d", a);}
inline void print_no_space(const char* a){printf("%s", a);}
inline void print_no_space(string a){printf("%s", a.c_str());}
inline void print_no_space(long long a){printf("%lld", a);}
inline void print_no_space(unsigned long a){printf("%ld", a);}
inline void print_no_space(unsigned int a){printf("%d", a);}
inline void print_no_space(char a){printf("%c", a);}

template<class Type> inline void print(vector<Type>& a){for(int i=0;i<a.size();++i)print(a[i]);}
template<class Type> inline void print(vector<vector<Type> >& a){if(a.size())(a.size()==1)?print(a[0]):writeln2(a[0]);for(int i=1;i<a.size()-1;++i)writeln2(a[i]);if(a.size()>=2)print_no_space(a.back());}
template<class Type> inline void print_no_space(vector<Type>& a){if(a.size())print_no_space(a[0]);for(int i=1;i<a.size();++i)print(a[i]);}
template<class Type> inline void print_no_space(vector<vector<Type> >&a){for(int i=0;i<a.size()-1;++i)writeln(a[i]);if(a.size())print_no_space(a.back());}

template<class Type1, class Type2> inline void print_no_space(pair<Type1, Type2>&a){print_no_space(a.first); writeln2(a.second);}
template<class Type1, class Type2> inline void print(pair<Type1, Type2>& a)        {print_no_space(a.first); writeln2(a.second);}

template <class Head, class... Tail> inline void writeln2(Head head, Tail... tail){print(head);writeln2(tail...);}
template <class Head, class... Tail> inline void writeln(Head head, Tail... tail){print_no_space(head);writeln2(tail...);}

inline void read(double &a){scanf("%lf",&a);}
inline void read(int &a){scanf("%d",&a);}
inline void read(string &a){cin>>a;}
inline void read(long long &a){scanf("%lld",&a);}
inline void read(char &a){scanf("%c",&a);}
template<class Type1, class Type2> inline void read(pair<Type1, Type2>&a){readln(a.first, a.second);}
template<class Type> inline void read(vector<Type> &a){if(a.size()==0){int n;read(n);a.resize(n);}for(int i=0;i<a.size();++i)readln(a[i]);}
template <class Head,class... Tail> inline void readln(Head& head,Tail&... tail){read(head);readln(tail...);}


//template igorjan94 version from 24 November 2014
#include <bits/stdc++.h>

#define pb push_back
#define ll long long
#define forit(it, r) for (auto it = r.begin(); it != r.end(); it++)
#define forn(i, n) for (int i = 0; i < n; ++i)
#define forn1(i, n) for (int i = 1; i < n; ++i)
#define FOR(i, m, n) for (int i = m; i < n; ++i)
#define ROF(i, m, n) for (int i = m; i >= n; --i)
#define fori(n) for (int i = 0; i < n; ++i)
#define forj(n) for (int j = 0; j < n; ++j)
#define fori1(n) for (int i = 1; i < n; ++i)
#define forj1(n) for (int j = 1; j < n; ++j)
#define vi vector<int>
#define vvi vector<vector<int> >
#define vll vector<long long>
#define pii pair<int, int>
#define pll pair<ll, ll>
#define whole(a) a.begin(), a.end()
#define fst first
#define cnd second

#ifndef ONLINE_JUDGE
#define lld I64d
#endif

#define FILENAME "input"
#define INF 1000000007
#define DOUBLEFORMAT "%f"

using namespace std;

template <class Head, class... Tail> inline void writeln(Head head, Tail... tail);
template <class Head, class... Tail> inline void writeln2(Head head, Tail... tail);
template <class Head, class... Tail> inline void readln(Head& head, Tail&... tail);
template <class Head, class... Tail> inline void read(Head& head, Tail&... tail);
template <class Head, class... Tail> inline void print(Head& head, Tail&... tail);
template <class Type1, class Type2>  inline void print(pair<Type1, Type2>& p);
template <class Type1, class Type2>  inline void print_no_space(pair<Type1, Type2>& p);
template <class Head, class... Tail> inline void print_no_space(Head& head, Tail&... tail);
void inline writeln(){printf("\n");}void inline writeln2(){printf("\n");}void inline readln(){}

///----------------------------------------------------------------------------------------------------------------------------

void run()
{
    vi a, b;
    set<int> A;
    readln(a, b);
    sort(whole(a));
    sort(whole(b));
    int n = a.size();
    int m = b.size();
    A.insert(0);
    A.insert(INF);
    fori(n)
        A.insert(a[i]);
    fori(m)
        A.insert(b[i]);
    ll sum1 = 0, sum2 = 0, mx = 0;
    pll ans;
    forit(i, A)
    {
        int j = upper_bound(whole(a), *i) - a.begin();
        sum1 = j * 2 + (a.size() - j) * 3;
        int k = upper_bound(whole(b), *i) - b.begin();
        sum2 = k * 2 + (b.size() - k) * 3;
        if (sum1 - sum2 >= mx)
            mx = sum1 - sum2,
            ans = {sum1, sum2};
    }
    printf("%lld:%lld\n", ans.first, ans.second);
}

int main()
{
//    freopen(FILENAME".in", "r", stdin);
//    freopen(FILENAME".out", "w", stdout);
    run();
    return 0;
}

inline void print(double a){printf(" " DOUBLEFORMAT,a);}
inline void print(int a){printf(" %d",a);}
inline void print(const char* a){printf(" %s",a);}
inline void print(string a){printf(" %s",a.c_str());}
inline void print(long long a){printf(" %lld",a);}
inline void print(unsigned long a){printf(" %ld",a);}
inline void print(unsigned int a){printf(" %d",a);}
inline void print(char a){printf(" %c",a);}
inline void print_no_space(double a){printf(DOUBLEFORMAT, a);}
inline void print_no_space(int a){printf("%d", a);}
inline void print_no_space(const char* a){printf("%s", a);}
inline void print_no_space(string a){printf("%s", a.c_str());}
inline void print_no_space(long long a){printf("%lld", a);}
inline void print_no_space(unsigned long a){printf("%ld", a);}
inline void print_no_space(unsigned int a){printf("%d", a);}
inline void print_no_space(char a){printf("%c", a);}

template<class Type> inline void print(vector<Type>& a){for(int i=0;i<a.size();++i)print(a[i]);}
template<class Type> inline void print(vector<vector<Type> >& a){if(a.size())(a.size()==1)?print(a[0]):writeln2(a[0]);for(int i=1;i<a.size()-1;++i)writeln2(a[i]);if(a.size()>=2)print_no_space(a.back());}
template<class Type> inline void print_no_space(vector<Type>& a){if(a.size())print_no_space(a[0]);for(int i=1;i<a.size();++i)print(a[i]);}
template<class Type> inline void print_no_space(vector<vector<Type> >&a){for(int i=0;i<a.size()-1;++i)writeln(a[i]);if(a.size())print_no_space(a.back());}

template<class Type1, class Type2> inline void print_no_space(pair<Type1, Type2>&a){print_no_space(a.first); writeln2(a.second);}
template<class Type1, class Type2> inline void print(pair<Type1, Type2>& a)        {print_no_space(a.first); writeln2(a.second);}

template <class Head, class... Tail> inline void writeln2(Head head, Tail... tail){print(head);writeln2(tail...);}
template <class Head, class... Tail> inline void writeln(Head head, Tail... tail){print_no_space(head);writeln2(tail...);}

inline void read(double &a){scanf("%lf",&a);}
inline void read(int &a){scanf("%d",&a);}
inline void read(string &a){cin>>a;}
inline void read(long long &a){scanf("%lld",&a);}
inline void read(char &a){scanf("%c",&a);}
template<class Type1, class Type2> inline void read(pair<Type1, Type2>&a){readln(a.first, a.second);}
template<class Type> inline void read(vector<Type> &a){if(a.size()==0){int n;read(n);a.resize(n);}for(int i=0;i<a.size();++i)readln(a[i]);}
template <class Head,class... Tail> inline void readln(Head& head,Tail&... tail){read(head);readln(tail...);}


//template igorjan94 version from 24 November 2014
#include <bits/stdc++.h>

#define pb push_back
#define ll long long
#define forit(it, r) for (auto it = r.begin(); it != r.end(); it++)
#define forn(i, n) for (int i = 0; i < n; ++i)
#define forn1(i, n) for (int i = 1; i < n; ++i)
#define FOR(i, m, n) for (int i = m; i < n; ++i)
#define ROF(i, m, n) for (int i = m; i >= n; --i)
#define fori(n) for (int i = 0; i < n; ++i)
#define forj(n) for (int j = 0; j < n; ++j)
#define fori1(n) for (int i = 1; i < n; ++i)
#define forj1(n) for (int j = 1; j < n; ++j)
#define vi vector<int>
#define vvi vector<vector<int> >
#define vll vector<long long>
#define pii pair<int, int>
#define pll pair<ll, ll>
#define whole(a) a.begin(), a.end()
#define fst first
#define cnd second

#ifndef ONLINE_JUDGE
#define lld I64d
#endif

#define FILENAME "input"
#define INF 1000000007
#define DOUBLEFORMAT "%f"

using namespace std;

template <class Head, class... Tail> inline void writeln(Head head, Tail... tail);
template <class Head, class... Tail> inline void writeln2(Head head, Tail... tail);
template <class Head, class... Tail> inline void readln(Head& head, Tail&... tail);
template <class Head, class... Tail> inline void read(Head& head, Tail&... tail);
template <class Head, class... Tail> inline void print(Head& head, Tail&... tail);
template <class Type1, class Type2>  inline void print(pair<Type1, Type2>& p);
template <class Type1, class Type2>  inline void print_no_space(pair<Type1, Type2>& p);
template <class Head, class... Tail> inline void print_no_space(Head& head, Tail&... tail);
void inline writeln(){printf("\n");}void inline writeln2(){printf("\n");}void inline readln(){}

///----------------------------------------------------------------------------------------------------------------------------

void run()
{
    vi a, b;
    set<int> A;
    readln(a, b);
    sort(whole(a));
    sort(whole(b));
    int n = a.size();
    int m = b.size();
    A.insert(0);
    A.insert(INF * 2);
    fori(n)
        A.insert(a[i]);
    fori(m)
        A.insert(b[i]);
    ll sum1 = 0, sum2 = 0, mx = 0;
    pll ans;
    forit(i, A)
    {
        ll j = upper_bound(whole(a), *i) - a.begin();
        sum1 = j * 2 + 1ll * (a.size() - j) * 3;
        ll k = upper_bound(whole(b), *i) - b.begin();
        sum2 = k * 2 + 1ll * (b.size() - k) * 3;
        if (sum1 - sum2 >= mx)
            mx = sum1 - sum2,
            ans = {sum1, sum2};
    }
    cout << ans.first << ":" << ans.second << "\n";
}

int main()
{
//    freopen(FILENAME".in", "r", stdin);
//    freopen(FILENAME".out", "w", stdout);
    run();
    return 0;
}

inline void print(double a){printf(" " DOUBLEFORMAT,a);}
inline void print(int a){printf(" %d",a);}
inline void print(const char* a){printf(" %s",a);}
inline void print(string a){printf(" %s",a.c_str());}
inline void print(long long a){printf(" %lld",a);}
inline void print(unsigned long a){printf(" %ld",a);}
inline void print(unsigned int a){printf(" %d",a);}
inline void print(char a){printf(" %c",a);}
inline void print_no_space(double a){printf(DOUBLEFORMAT, a);}
inline void print_no_space(int a){printf("%d", a);}
inline void print_no_space(const char* a){printf("%s", a);}
inline void print_no_space(string a){printf("%s", a.c_str());}
inline void print_no_space(long long a){printf("%lld", a);}
inline void print_no_space(unsigned long a){printf("%ld", a);}
inline void print_no_space(unsigned int a){printf("%d", a);}
inline void print_no_space(char a){printf("%c", a);}

template<class Type> inline void print(vector<Type>& a){for(int i=0;i<a.size();++i)print(a[i]);}
template<class Type> inline void print(vector<vector<Type> >& a){if(a.size())(a.size()==1)?print(a[0]):writeln2(a[0]);for(int i=1;i<a.size()-1;++i)writeln2(a[i]);if(a.size()>=2)print_no_space(a.back());}
template<class Type> inline void print_no_space(vector<Type>& a){if(a.size())print_no_space(a[0]);for(int i=1;i<a.size();++i)print(a[i]);}
template<class Type> inline void print_no_space(vector<vector<Type> >&a){for(int i=0;i<a.size()-1;++i)writeln(a[i]);if(a.size())print_no_space(a.back());}

template<class Type1, class Type2> inline void print_no_space(pair<Type1, Type2>&a){print_no_space(a.first); writeln2(a.second);}
template<class Type1, class Type2> inline void print(pair<Type1, Type2>& a)        {print_no_space(a.first); writeln2(a.second);}

template <class Head, class... Tail> inline void writeln2(Head head, Tail... tail){print(head);writeln2(tail...);}
template <class Head, class... Tail> inline void writeln(Head head, Tail... tail){print_no_space(head);writeln2(tail...);}

inline void read(double &a){scanf("%lf",&a);}
inline void read(int &a){scanf("%d",&a);}
inline void read(string &a){cin>>a;}
inline void read(long long &a){scanf("%lld",&a);}
inline void read(char &a){scanf("%c",&a);}
template<class Type1, class Type2> inline void read(pair<Type1, Type2>&a){readln(a.first, a.second);}
template<class Type> inline void read(vector<Type> &a){if(a.size()==0){int n;read(n);a.resize(n);}for(int i=0;i<a.size();++i)readln(a[i]);}
template <class Head,class... Tail> inline void readln(Head& head,Tail&... tail){read(head);readln(tail...);}


//template igorjan94 version from 24 November 2014
#include <bits/stdc++.h>

#define pb push_back
#define ll long long
#define forit(it, r) for (auto it = r.begin(); it != r.end(); it++)
#define forn(i, n) for (int i = 0; i < n; ++i)
#define forn1(i, n) for (int i = 1; i < n; ++i)
#define FOR(i, m, n) for (int i = m; i < n; ++i)
#define ROF(i, m, n) for (int i = m; i >= n; --i)
#define fori(n) for (int i = 0; i < n; ++i)
#define forj(n) for (int j = 0; j < n; ++j)
#define fori1(n) for (int i = 1; i < n; ++i)
#define forj1(n) for (int j = 1; j < n; ++j)
#define vi vector<int>
#define vvi vector<vector<int> >
#define vll vector<long long>
#define pii pair<int, int>
#define pll pair<ll, ll>
#define whole(a) a.begin(), a.end()
#define fst first
#define cnd second

#ifndef ONLINE_JUDGE
#define lld I64d
#endif

#define FILENAME "input"
#define INF 1000000007
#define DOUBLEFORMAT "%f"

using namespace std;

template <class Head, class... Tail> inline void writeln(Head head, Tail... tail);
template <class Head, class... Tail> inline void writeln2(Head head, Tail... tail);
template <class Head, class... Tail> inline void readln(Head& head, Tail&... tail);
template <class Head, class... Tail> inline void read(Head& head, Tail&... tail);
template <class Head, class... Tail> inline void print(Head& head, Tail&... tail);
template <class Type1, class Type2>  inline void print(pair<Type1, Type2>& p);
template <class Type1, class Type2>  inline void print_no_space(pair<Type1, Type2>& p);
template <class Head, class... Tail> inline void print_no_space(Head& head, Tail&... tail);
void inline writeln(){printf("\n");}void inline writeln2(){printf("\n");}void inline readln(){}

///----------------------------------------------------------------------------------------------------------------------------

void run()
{
    vi a, b;
    set<int> A;
    readln(a, b);
    sort(whole(a));
    sort(whole(b));
    int n = a.size();
    int m = b.size();
    A.insert(0);
    A.insert(INF * 2);
    fori(n)
        A.insert(a[i]);
    fori(m)
        A.insert(b[i]);
    ll sum1 = 0, sum2 = 0, mx = 0;
    pll ans;
    forit(i, A)
    {
        ll j = upper_bound(whole(a), *i) - a.begin();
        sum1 = j * 2 + 1ll * (a.size() - j) * 3;
        ll k = upper_bound(whole(b), *i) - b.begin();
        sum2 = k * 2 + 1ll * (b.size() - k) * 3;
        if (*i == 0 || sum1 - sum2 > mx)
            mx = sum1 - sum2,
            ans = {sum1, sum2};
        else
            if (sum1 - sum2 == mx)
                if (sum1 > ans.first)
                    ans = {sum1, sum2};
    }
    cout << ans.first << ":" << ans.second << "\n";
}

int main()
{
//    freopen(FILENAME".in", "r", stdin);
//    freopen(FILENAME".out", "w", stdout);
    run();
    return 0;
}

inline void print(double a){printf(" " DOUBLEFORMAT,a);}
inline void print(int a){printf(" %d",a);}
inline void print(const char* a){printf(" %s",a);}
inline void print(string a){printf(" %s",a.c_str());}
inline void print(long long a){printf(" %lld",a);}
inline void print(unsigned long a){printf(" %ld",a);}
inline void print(unsigned int a){printf(" %d",a);}
inline void print(char a){printf(" %c",a);}
inline void print_no_space(double a){printf(DOUBLEFORMAT, a);}
inline void print_no_space(int a){printf("%d", a);}
inline void print_no_space(const char* a){printf("%s", a);}
inline void print_no_space(string a){printf("%s", a.c_str());}
inline void print_no_space(long long a){printf("%lld", a);}
inline void print_no_space(unsigned long a){printf("%ld", a);}
inline void print_no_space(unsigned int a){printf("%d", a);}
inline void print_no_space(char a){printf("%c", a);}

template<class Type> inline void print(vector<Type>& a){for(int i=0;i<a.size();++i)print(a[i]);}
template<class Type> inline void print(vector<vector<Type> >& a){if(a.size())(a.size()==1)?print(a[0]):writeln2(a[0]);for(int i=1;i<a.size()-1;++i)writeln2(a[i]);if(a.size()>=2)print_no_space(a.back());}
template<class Type> inline void print_no_space(vector<Type>& a){if(a.size())print_no_space(a[0]);for(int i=1;i<a.size();++i)print(a[i]);}
template<class Type> inline void print_no_space(vector<vector<Type> >&a){for(int i=0;i<a.size()-1;++i)writeln(a[i]);if(a.size())print_no_space(a.back());}

template<class Type1, class Type2> inline void print_no_space(pair<Type1, Type2>&a){print_no_space(a.first); writeln2(a.second);}
template<class Type1, class Type2> inline void print(pair<Type1, Type2>& a)        {print_no_space(a.first); writeln2(a.second);}

template <class Head, class... Tail> inline void writeln2(Head head, Tail... tail){print(head);writeln2(tail...);}
template <class Head, class... Tail> inline void writeln(Head head, Tail... tail){print_no_space(head);writeln2(tail...);}

inline void read(double &a){scanf("%lf",&a);}
inline void read(int &a){scanf("%d",&a);}
inline void read(string &a){cin>>a;}
inline void read(long long &a){scanf("%lld",&a);}
inline void read(char &a){scanf("%c",&a);}
template<class Type1, class Type2> inline void read(pair<Type1, Type2>&a){readln(a.first, a.second);}
template<class Type> inline void read(vector<Type> &a){if(a.size()==0){int n;read(n);a.resize(n);}for(int i=0;i<a.size();++i)readln(a[i]);}
template <class Head,class... Tail> inline void readln(Head& head,Tail&... tail){read(head);readln(tail...);}


#include <stdio.h>
#include <algorithm>

using namespace std;

int main() {
  int N, M, *a, *b;
  int besta = -1, bestb = -1;
  scanf("%d", &N);
  a = new int[N+1];
  for(int i=1; i<=N; ++i) scanf("%d", a+i);
  scanf("%d", &M);
  b = new int[M+1];
  for(int i=1; i<=M; ++i) scanf("%d", b+i);
  sort(a+1, a+1+N);
  sort(b+1, b+1+M);
  for(int i=1; i<=N; ++i) {
    int cura = (i-1)*2 + (N-i+1)*3;
    int lo = 1, hi = M, res = 0;
    while(lo <= hi) {
      int mid = (lo+hi)/2;
      if(b[mid] >= a[i]) hi = mid-1, res = M-mid+1;
      else lo = mid+1;
    }
    int curb = res*3 + (M-res)*2;
    if(cura-curb > besta-bestb || (cura-curb == besta-bestb && cura > besta)) {
      besta = cura;
      bestb = curb;
    }
  }
  printf("%d:%d\n", besta, bestb);
  return 0;
}


#include <stdio.h>
#include <algorithm>

using namespace std;

int a[200005], b[200005];

int main() {
  int N, M;
  int besta = -1, bestb = -1;
  scanf("%d", &N);
  for(int i=1; i<=N; ++i) scanf("%d", a+i);
  scanf("%d", &M);
  for(int i=1; i<=M; ++i) scanf("%d", b+i);
  sort(a, a+N);
  sort(b, b+M);
  for(int i=1; i<=N; ++i) {
    int cura = (i-1)*2 + (N-i+1)*3;
    int lo = 1, hi = M, res = 0;
    while(lo <= hi) {
      int mid = (lo+hi)/2;
      if(b[mid] >= a[i]) hi = mid-1, res = M-mid+1;
      else lo = mid+1;
    }
    int curb = res*3 + (M-res)*2;
    if(besta == -1 || (cura-curb > besta-bestb || (cura-curb == besta-bestb && cura > besta))) {
      besta = cura;
      bestb = curb;
    }
  }
  printf("%d:%d\n", besta, bestb);
  return 0;
}


#include <stdio.h>
#include <algorithm>

using namespace std;

int main() {
  int N, M, *a, *b;
  int besta = -1, bestb = -1;
  scanf("%d", &N);
  a = new int[N+1];
  for(int i=1; i<=N; ++i) scanf("%d", a+i);
  scanf("%d", &M);
  b = new int[M+1];
  for(int i=1; i<=M; ++i) scanf("%d", b+i);
  sort(a+1, a+1+N);
  sort(b+1, b+1+M);
  for(int i=1; i<=N; ++i) {
    int cura = (i-1)*2 + (N-i+1)*3;
    int lo = 1, hi = M, res = 0;
    while(lo <= hi) {
      int mid = (lo+hi)/2;
      if(b[mid] >= a[i]) hi = mid-1, res = M-mid+1;
      else lo = mid+1;
    }
    int curb = res*3 + (M-res)*2;
    if(besta == -1 || (cura-curb > besta-bestb || (cura-curb == besta-bestb && cura > besta))) {
      besta = cura;
      bestb = curb;
    }
  }
  if(2*N - 2*M > besta - bestb) {
    besta = 2*N;
    bestb = 2*M;
  }
  printf("%d:%d\n", besta, bestb);
  return 0;
}


#include <stdio.h>
#include <algorithm>
#include <map>

using namespace std;

int a[200005], b[200005];

int main() {
  map<int, int> help;
  int N, M;
  int besta = -1, bestb = -1;
  scanf("%d", &N);
  for(int i=1; i<=N; ++i) {
    scanf("%d", a+i);
    help[a[i]]++;
  }
  scanf("%d", &M);
  for(int i=1; i<=M; ++i) scanf("%d", b+i);
  sort(a, a+N);
  sort(b, b+M);
  for(int i=1; i<=N; ++i) {
    int cura = (i-help[a[i]])*2 + (N-i+help[a[i]])*3;
    int lo = 1, hi = M, res = 0;
    while(lo <= hi) {
      int mid = (lo+hi)/2;
      if(b[mid] >= a[i]) hi = mid-1, res = M-mid+1;
      else lo = mid+1;
    }
    int curb = res*3 + (M-res)*2;
    if(besta == -1 || (cura-curb > besta-bestb || (cura-curb == besta-bestb && cura > besta))) {
      besta = cura;
      bestb = curb;
    }
  }
  if(2*N - 2*M > besta - bestb) {
    besta = 2*N;
    bestb = 2*M;
  }
  printf("%d:%d\n", besta, bestb);
  return 0;
}


#include <stdio.h>
#include <algorithm>
#include <map>

using namespace std;

int a[200005], b[200005];
map<int, pair<int, int> > help;

int main() {
  int N, M;
  int besta = -1, bestb = -1;
  scanf("%d", &N);
  for(int i=1; i<=N; ++i) scanf("%d", a+i);
  scanf("%d", &M);
  for(int i=1; i<=M; ++i) scanf("%d", b+i);
  sort(a+1, a+N+1);
  sort(b+1, b+M+1);
  for(int i=1; i<=N; ) {
    int j=i;
    while(j <= N && a[j] == a[i]) j++;
    help[a[i]] = make_pair(i, j-1);
    i = j;
  }
  for(int i=1; i<=N; ++i) {
    int cura = (help[a[i]].first-1)*2 + (N-help[a[i]].first+1)*3;
    int lo = 1, hi = M, res = 0;
    while(lo <= hi) {
      int mid = (lo+hi)/2;
      if(b[mid] >= a[i]) hi = mid-1, res = M-mid+1;
      else lo = mid+1;
    }
    int curb = res*3 + (M-res)*2;
    if(besta == -1 || (cura-curb > besta-bestb || (cura-curb == besta-bestb && cura > besta))) {
      besta = cura;
      bestb = curb;
    }
  }
  if(2*N - 2*M > besta - bestb) {
    besta = 2*N;
    bestb = 2*M;
  }
  printf("%d:%d\n", besta, bestb);
  return 0;
}


#include <stdio.h>
#include <algorithm>

using namespace std;

int a[200005], b[200005];

int main() {
  int N, M;
  int besta = -1, bestb = -1;
  scanf("%d", &N);
  for(int i=1; i<=N; ++i) scanf("%d", a+i);
  scanf("%d", &M);
  for(int i=1; i<=M; ++i) scanf("%d", b+i);
  sort(a, a+N);
  sort(b, b+M);
  for(int i=1; i<=N; ++i) {
    int cura = (i-1)*2 + (N-i+1)*3;
    int lo = 1, hi = M, res = 0;
    while(lo <= hi) {
      int mid = (lo+hi)/2;
      if(b[mid] >= a[i]) hi = mid-1, res = M-mid+1;
      else lo = mid+1;
    }
    int curb = res*3 + (M-res)*2;
    if(besta == -1 || (cura-curb > besta-bestb || (cura-curb == besta-bestb && cura > besta))) {
      besta = cura;
      bestb = curb;
    }
  }
  if(2*N - 2*M > besta - bestb) {
    besta = 2*N;
    bestb = 2*M;
  }
  printf("%d:%d\n", besta, bestb);
  return 0;
}


#include <stdio.h>
#include <algorithm>

using namespace std;

int main() {
  int N, M, *a, *b;
  int besta = -1, bestb = -1;
  scanf("%d", &N);
  a = new int[N+1];
  for(int i=1; i<=N; ++i) scanf("%d", a+i);
  scanf("%d", &M);
  b = new int[M+1];
  for(int i=1; i<=M; ++i) scanf("%d", b+i);
  sort(a+1, a+1+N);
  sort(b+1, b+1+M);
  for(int i=1; i<=N; ++i) {
    int cura = (i-1)*2 + (N-i+1)*3;
    int lo = 1, hi = M, res = 0;
    while(lo <= hi) {
      int mid = (lo+hi)/2;
      if(b[mid] >= a[i]) hi = mid-1, res = M-mid+1;
      else lo = mid+1;
    }
    int curb = res*3 + (M-res)*2;
    if(cura-curb > besta-bestb || (cura-curb == besta-bestb && cura > besta)) {
      besta = cura;
      bestb = curb;
    }
  }
  if(2*N - 2*M > besta - bestb) {
    besta = 2*N;
    bestb = 2*M;
  }
  printf("%d:%d\n", besta, bestb);
  return 0;
}


#include <stdio.h>
#include <algorithm>

using namespace std;

int main() {
  int N, M, *a, *b;
  int besta = -1, bestb = -1;
  scanf("%d", &N);
  a = new int[N+1];
  for(int i=1; i<=N; ++i) scanf("%d", a+i);
  scanf("%d", &M);
  b = new int[M+1];
  for(int i=1; i<=M; ++i) scanf("%d", b+i);
  sort(a, a+N);
  sort(b, b+M);
  for(int i=1; i<=N; ++i) {
    int cura = (i-1)*2 + (N-i+1)*3;
    int lo = 1, hi = M, res = 0;
    while(lo <= hi) {
      int mid = (lo+hi)/2;
      if(b[mid] >= a[i]) hi = mid-1, res = M-mid+1;
      else lo = mid+1;
    }
    int curb = res*3 + (M-res)*2;
    if(cura-curb > besta-bestb || (cura-curb == besta-bestb && cura > besta)) {
      besta = cura;
      bestb = curb;
    }
  }
  if(2*N - 2*M > besta - bestb) {
    besta = 2*N;
    bestb = 2*M;
  }
  printf("%d:%d\n", besta, bestb);
  return 0;
}


#include <stdio.h>
#include <algorithm>

using namespace std;

int main() {
  int N, M, *a, *b;
  int besta = -1, bestb = -1;
  scanf("%d", &N);
  a = new int[N+1];
  for(int i=1; i<=N; ++i) scanf("%d", a+i);
  scanf("%d", &M);
  b = new int[M+1];
  for(int i=1; i<=M; ++i) scanf("%d", b+i);
  sort(a, a+N);
  sort(b, b+M);
  for(int i=1; i<=N; ++i) {
    int cura = (i-1)*2 + (N-i+1)*3;
    int lo = 1, hi = M, res = 0;
    while(lo <= hi) {
      int mid = (lo+hi)/2;
      if(b[mid] >= a[i]) hi = mid-1, res = M-mid+1;
      else lo = mid+1;
    }
    int curb = res*3 + (M-res)*2;
    if(besta == -1 || (cura-curb > besta-bestb || (cura-curb == besta-bestb && cura > besta))) {
      besta = cura;
      bestb = curb;
    }
  }
  printf("%d:%d\n", besta, bestb);
  return 0;
}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef vector <int> vi;
typedef vector <int>::iterator vit;
typedef pair <int, int> pii;
typedef vector < pair <int, int> > vii;
typedef vector < pair <int, int > >::iterator viit;
typedef set <int> si;
typedef set <int>::iterator sit;

#define ALL(a) (a).begin(), (a).end()
#define SORT(a) std::sort((a).begin(), (a).end())
#define REVERSE(a) std::reverse((a).begin(), (a).end())
#ifdef _HOME_
    #define LOG(e) cout << #e << " = " << e << endl;
#else
    #define LOG(e)
#endif
#define X first
#define Y second
#define sqr(a) ((a)*(a))
#define FORI(n) for (int i = 0; i < n; ++i)
#define FOR(i, n) for (int i = 0; i < n; ++i)

template <typename T> istream &operator>>(istream &in, vector <T> &v) { for (size_t i = 0; i < v.size(); ++i) in >> v[i]; return in; }
template <typename T> ostream &operator<<(ostream &out, vector <T> const &v) { for (size_t i = 0; i < v.size(); ++i) out << v[i] << " "; return out; }

#define EPS 1e-7
#define MOD (1000000000 + 7)
#define PI 3.14159265358979323846
#define INF 1000000000

void solution();

int main()
{
#ifdef _HOME_
	freopen("input.txt", "r", stdin);
	const clock_t start = clock();
#endif
    ios::sync_with_stdio(false);
    solution();
#ifdef _HOME_
    cout.precision(5);
    cout << endl << "Time: " << fixed << double( clock () - start ) /  (double)CLOCKS_PER_SEC << endl;
#endif
    return EXIT_SUCCESS;
}

void solution()
{
    int n, m;
    cin >> n;
    vector <ll> a(n);
    cin >> a;
    cin >> m;
    vector <ll> b(m);
    cin >> b;
    sort(ALL(a));
    sort(ALL(b));
    int i = 0, j = 0;
    ll d = 0, mx = -1, ma = -1, mb = -1;
    while (i < a.size() || j < b.size())
    {
        while (i < a.size() && a[i] <= d)
            ++i;
        while (j < b.size() && b[j] <= d)
            ++j;
        ll va = (ll)(i * 2LL + (a.size() - i) * 3LL);
        ll vb = (ll)(j * 2LL + (b.size() - j) * 3LL);
        ll v = va - vb;
        if (v > mx)
        {
            ma = va;
            mb = vb;
            mx = v;
        }
        else if (v == mx && va > ma)
        {
            ma = va;
            mb = vb;
            mx = v;
        }

        if (i < a.size() && j < b.size())
        {
            d = min(a[i], b[j]);
        }
        else if (i < a.size())
        {
            d = a[i];
        }
        else if (j < b.size())
        {
            d = b[j];
        }
        else
        {
            ++d;
        }
    }
    cout << ma << ":" << mb << endl;
#ifdef _HOME_
    cout << mx << endl;
#endif
}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef vector <int> vi;
typedef vector <int>::iterator vit;
typedef pair <int, int> pii;
typedef vector < pair <int, int> > vii;
typedef vector < pair <int, int > >::iterator viit;
typedef set <int> si;
typedef set <int>::iterator sit;

#define ALL(a) (a).begin(), (a).end()
#define SORT(a) std::sort((a).begin(), (a).end())
#define REVERSE(a) std::reverse((a).begin(), (a).end())
#ifdef _HOME_
    #define LOG(e) cout << #e << " = " << e << endl;
#else
    #define LOG(e)
#endif
#define X first
#define Y second
#define sqr(a) ((a)*(a))
#define FORI(n) for (int i = 0; i < n; ++i)
#define FOR(i, n) for (int i = 0; i < n; ++i)

template <typename T> istream &operator>>(istream &in, vector <T> &v) { for (size_t i = 0; i < v.size(); ++i) in >> v[i]; return in; }
template <typename T> ostream &operator<<(ostream &out, vector <T> const &v) { for (size_t i = 0; i < v.size(); ++i) out << v[i] << " "; return out; }

#define EPS 1e-7
#define MOD (1000000000 + 7)
#define PI 3.14159265358979323846
#define INF 1000000000

void solution();

int main()
{
#ifdef _HOME_
	freopen("input.txt", "r", stdin);
	const clock_t start = clock();
#endif
    ios::sync_with_stdio(false);
    solution();
#ifdef _HOME_
    cout.precision(5);
    cout << endl << "Time: " << fixed << double( clock () - start ) /  (double)CLOCKS_PER_SEC << endl;
#endif
    return EXIT_SUCCESS;
}

void solution()
{
    int n, m;
    cin >> n;
    vector <ll> a(n);
    cin >> a;
    cin >> m;
    vector <ll> b(m);
    cin >> b;
    sort(ALL(a));
    sort(ALL(b));
    int i = 0, j = 0;
    ll d = 0, mx = -1, ma = -1, mb = -1;
    while (i < a.size() || j < b.size())
    {
        while (i < a.size() && a[i] <= d)
            ++i;
        while (j < b.size() && b[j] <= d)
            ++j;
        ll va = (ll)(i * 2LL + (a.size() - i) * 3LL);
        ll vb = (ll)(j * 2LL + (b.size() - j) * 3LL);
        ll v = abs(va - vb);
        if (v > mx)
        {
            ma = va;
            mb = vb;
            mx = v;
        }
        else if (v == mx && va > ma)
        {
            ma = va;
            mb = vb;
            mx = v;
        }

        if (i < a.size() && j < b.size())
        {
            d = min(a[i], b[j]);
        }
        else if (i < a.size())
        {
            d = a[i];
        }
        else if (j < b.size())
        {
            d = b[j];
        }
        else
        {
            ++d;
        }
    }
    cout << ma << ":" << mb << endl;
#ifdef _HOME_
    cout << mx << endl;
#endif
}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef vector <int> vi;
typedef vector <int>::iterator vit;
typedef pair <int, int> pii;
typedef vector < pair <int, int> > vii;
typedef vector < pair <int, int > >::iterator viit;
typedef set <int> si;
typedef set <int>::iterator sit;

#define ALL(a) (a).begin(), (a).end()
#define SORT(a) std::sort((a).begin(), (a).end())
#define REVERSE(a) std::reverse((a).begin(), (a).end())
#ifdef _HOME_
    #define LOG(e) cout << #e << " = " << e << endl;
#else
    #define LOG(e)
#endif
#define X first
#define Y second
#define sqr(a) ((a)*(a))
#define FORI(n) for (int i = 0; i < n; ++i)
#define FOR(i, n) for (int i = 0; i < n; ++i)

template <typename T> istream &operator>>(istream &in, vector <T> &v) { for (size_t i = 0; i < v.size(); ++i) in >> v[i]; return in; }
template <typename T> ostream &operator<<(ostream &out, vector <T> const &v) { for (size_t i = 0; i < v.size(); ++i) out << v[i] << " "; return out; }

#define EPS 1e-7
#define MOD (1000000000 + 7)
#define PI 3.14159265358979323846
#define INF 1000000000

void solution();

int main()
{
#ifdef _HOME_
	freopen("input.txt", "r", stdin);
	const clock_t start = clock();
#endif
    ios::sync_with_stdio(false);
    solution();
#ifdef _HOME_
    cout.precision(5);
    cout << endl << "Time: " << fixed << double( clock () - start ) /  (double)CLOCKS_PER_SEC << endl;
#endif
    return EXIT_SUCCESS;
}

void solution()
{
    int n, m;
    cin >> n;
    vector <ll> a(n);
    cin >> a;
    cin >> m;
    vector <ll> b(m);
    cin >> b;
    sort(ALL(a));
    sort(ALL(b));
    int i = 0, j = 0;
    ll d = 0, mx = -1, ma = -1, mb = -1;
    while (i < a.size() || j < b.size())
    {
        while (i < a.size() && a[i] <= d)
            ++i;
        while (j < b.size() && b[j] <= d)
            ++j;
        ll va = (ll)((ll)i * 2LL + (ll)(a.size() - i) * 3LL);
        ll vb = (ll)((ll)j * 2LL + (ll)(b.size() - j) * 3LL);
        ll v = abs(va - vb);
        if (v > mx)
        {
            ma = va;
            mb = vb;
            mx = v;
        }
        else if (v == mx && va > ma)
        {
            ma = va;
            mb = vb;
            mx = v;
        }

        if (i < a.size() && j < b.size())
        {
            d = min(a[i], b[j]);
        }
        else if (i < a.size())
        {
            d = a[i];
        }
        else if (j < b.size())
        {
            d = b[j];
        }
        else
        {
            ++d;
        }
    }
    cout << ma << ":" << mb << endl;
#ifdef _HOME_
    cout << mx << endl;
#endif
}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef vector <int> vi;
typedef vector <int>::iterator vit;
typedef pair <int, int> pii;
typedef vector < pair <int, int> > vii;
typedef vector < pair <int, int > >::iterator viit;
typedef set <int> si;
typedef set <int>::iterator sit;

#define ALL(a) (a).begin(), (a).end()
#define SORT(a) std::sort((a).begin(), (a).end())
#define REVERSE(a) std::reverse((a).begin(), (a).end())
#ifdef _HOME_
    #define LOG(e) cout << #e << " = " << e << endl;
#else
    #define LOG(e)
#endif
#define X first
#define Y second
#define sqr(a) ((a)*(a))
#define FORI(n) for (int i = 0; i < n; ++i)
#define FOR(i, n) for (int i = 0; i < n; ++i)

template <typename T> istream &operator>>(istream &in, vector <T> &v) { for (size_t i = 0; i < v.size(); ++i) in >> v[i]; return in; }
template <typename T> ostream &operator<<(ostream &out, vector <T> const &v) { for (size_t i = 0; i < v.size(); ++i) out << v[i] << " "; return out; }

#define EPS 1e-7
#define MOD (1000000000 + 7)
#define PI 3.14159265358979323846
#define INF 1000000000

void solution();

int main()
{
#ifdef _HOME_
	freopen("input.txt", "r", stdin);
	const clock_t start = clock();
#endif
    ios::sync_with_stdio(false);
    solution();
#ifdef _HOME_
    cout.precision(5);
    cout << endl << "Time: " << fixed << double( clock () - start ) /  (double)CLOCKS_PER_SEC << endl;
#endif
    return EXIT_SUCCESS;
}

void solution()
{
    int n, m;
    cin >> n;
    vector <ll> a(n);
    cin >> a;
    cin >> m;
    vector <ll> b(m);
    cin >> b;
    sort(ALL(a));
    sort(ALL(b));
    int i = 0, j = 0;
    ll d = 0, mx = -1, ma = -1, mb = -1;
    while (i < a.size() || j < b.size())
    {
        while (i < a.size() && a[i] <= d)
            ++i;
        while (j < b.size() && b[j] <= d)
            ++j;
        ll va = (ll)(i * 2 + (a.size() - i) * 3);
        ll vb = (ll)(j * 2 + (b.size() - j) * 3);
        ll v = abs(va - vb);
        if (v > mx)
        {
            ma = va;
            mb = vb;
            mx = v;
        }
        else if (v == mx && va > ma)
        {
            ma = va;
            mb = vb;
            mx = v;
        }
        if (i < a.size() && j < b.size())
        {
            d = min(a[i], b[j]);
        }
        else if (i < a.size())
        {
            d = a[i];
        }
        else if (j < b.size())
        {
            d = b[j];
        }
    }
    cout << ma << ":" << mb << endl;
#ifdef _HOME_
    cout << mx << endl;
#endif
}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef vector <int> vi;
typedef vector <int>::iterator vit;
typedef pair <int, int> pii;
typedef vector < pair <int, int> > vii;
typedef vector < pair <int, int > >::iterator viit;
typedef set <int> si;
typedef set <int>::iterator sit;

#define ALL(a) (a).begin(), (a).end()
#define SORT(a) std::sort((a).begin(), (a).end())
#define REVERSE(a) std::reverse((a).begin(), (a).end())
#ifdef _HOME_
    #define LOG(e) cout << #e << " = " << e << endl;
#else
    #define LOG(e)
#endif
#define X first
#define Y second
#define sqr(a) ((a)*(a))
#define FORI(n) for (int i = 0; i < n; ++i)
#define FOR(i, n) for (int i = 0; i < n; ++i)

template <typename T> istream &operator>>(istream &in, vector <T> &v) { for (size_t i = 0; i < v.size(); ++i) in >> v[i]; return in; }
template <typename T> ostream &operator<<(ostream &out, vector <T> const &v) { for (size_t i = 0; i < v.size(); ++i) out << v[i] << " "; return out; }

#define EPS 1e-7
#define MOD (1000000000 + 7)
#define PI 3.14159265358979323846
#define INF 1000000000

void solution();

int main()
{
#ifdef _HOME_
	freopen("input.txt", "r", stdin);
	const clock_t start = clock();
#endif
    ios::sync_with_stdio(false);
    solution();
#ifdef _HOME_
    cout.precision(5);
    cout << endl << "Time: " << fixed << double( clock () - start ) /  (double)CLOCKS_PER_SEC << endl;
#endif
    return EXIT_SUCCESS;
}

void solution()
{
    int n, m;
    cin >> n;
    vector <ll> a(n);
    cin >> a;
    cin >> m;
    vector <ll> b(m);
    cin >> b;
    sort(ALL(a));
    sort(ALL(b));
    int i = 0, j = 0;
    ll d = 0, mx = -1000000000000LL, ma = -1, mb = -1;
    while (i < a.size() || j < b.size())
    {
        while (i < a.size() && a[i] <= d)
            ++i;
        while (j < b.size() && b[j] <= d)
            ++j;
        ll va = (ll)(i * 2LL + (a.size() - i) * 3LL);
        ll vb = (ll)(j * 2LL + (b.size() - j) * 3LL);
        ll v = va - vb;
        if (v > mx)
        {
            ma = va;
            mb = vb;
            mx = v;
        }
        else if (v == mx && va > ma)
        {
            ma = va;
            mb = vb;
            mx = v;
        }

        if (i < a.size() && j < b.size())
        {
            d = min(a[i], b[j]);
        }
        else if (i < a.size())
        {
            d = a[i];
        }
        else if (j < b.size())
        {
            d = b[j];
        }
        else
        {
            ++d;
        }
    }
    cout << ma << ":" << mb << endl;
#ifdef _HOME_
    cout << mx << endl;
#endif
}


#include<bits/stdc++.h>
#define pn() printf("\n")
#define si(x) scanf("%d",&x)
#define pi(x) printf("%d\n",x)
#define sll(x) scanf("%lld",&x)
#define pll(x) printf("%lld\n",x)
#define sc(x) scanf("%c",&x)
#define pc(x) printf("%c",x)
#define sf(x) scanf("%f",&x)
#define pf(x) printf("%f\n",x)
#define sd(x) scanf("%lf",&x)
#define pd(x) printf("%.7lf\n",x)
#define sld(x) scanf("%Lf",&x)
#define pld(x) printf("%.9Lf\n",x)
#define MOD 1000000007
#define ll long long
using namespace std;
struct st{
    int d;
    char type;
}ss[500001];
bool operator < (st a,st b){
    return a.d<b.d;
}
int idx=1;
int main(void){
    int n;
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>ss[idx].d;
        ss[idx].type='a';
        idx++;
    }
    int m;
    cin>>m;
    for(int i=1;i<=m;i++){
        cin>>ss[idx].d;
        ss[idx].type='b';
        idx++;
    }
    sort(ss+1,ss+idx);
//    for(int i=1;i<idx;i++){
//        cout<<ss[i].d<<endl;
//    }
    int maxprofit=3*n-3*m;
    int ans1=3*n,ans2=3*m;
    int acnt=0,bcnt=0;
    int save;
    //cout<<ans1<<" "<<ans2<<endl;
    for(int i=1;i<idx;i++){
        if(ss[i].type=='a'){
            acnt++;
        }
        else{
            bcnt++;
        }
        if(i<idx+1&&ss[i].d==ss[i+1].d){
            i++;
            continue;
        }
        int ascore=2*acnt+3*(n-acnt);
        int bscore=2*bcnt+3*(m-bcnt);
        int profithere=ascore-bscore;
        if(profithere>maxprofit){
            save=ss[i].d;
            //cout<<"hello:"<<ss[i].d<<" "<<profithere<<endl;
            maxprofit=profithere;
            ans1=ascore;
            ans2=bscore;
        }
    }
    if(maxprofit<2*n-2*m){
        maxprofit=2*n-2*m;
        ans1=2*n;
        ans2=2*m;
    }
    cout<<ans1<<":"<<ans2;
    return 0;
}


#include<bits/stdc++.h>
#define pn() printf("\n")
#define si(x) scanf("%d",&x)
#define pi(x) printf("%d\n",x)
#define sll(x) scanf("%lld",&x)
#define pll(x) printf("%lld\n",x)
#define sc(x) scanf("%c",&x)
#define pc(x) printf("%c",x)
#define sf(x) scanf("%f",&x)
#define pf(x) printf("%f\n",x)
#define sd(x) scanf("%lf",&x)
#define pd(x) printf("%.7lf\n",x)
#define sld(x) scanf("%Lf",&x)
#define pld(x) printf("%.9Lf\n",x)
#define MOD 1000000007
#define ll long long
using namespace std;
struct st{
    int d;
    char type;
}ss[500001];
bool operator < (st a,st b){
    return a.d<b.d;
}
int idx=1;
int main(void){
    int n;
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>ss[idx].d;
        ss[idx].type='a';
        idx++;
    }
    int m;
    cin>>m;
    for(int i=1;i<=m;i++){
        cin>>ss[idx].d;
        ss[idx].type='b';
        idx++;
    }
    sort(ss+1,ss+idx);
//    for(int i=1;i<idx;i++){
//        cout<<ss[i].d<<endl;
//    }
    int maxprofit=3*n-3*m;
    int ans1=3*n,ans2=3*m;
    if(maxprofit<2*n-2*m){
        maxprofit=2*n-2*m;
        ans1=2*n;
        ans2=3*m;
    }
    int acnt=0,bcnt=0;
    //cout<<ans1<<" "<<ans2<<endl;
    for(int i=1;i<idx;i++){
        if(ss[i].type=='a'){
            acnt++;
        }
        else{
            bcnt++;
        }
        int ascore=2*acnt+3*(n-acnt);
        int bscore=2*bcnt+3*(m-bcnt);
        int profithere=ascore-bscore;
        if(profithere>maxprofit){
            //cout<<"hello:"<<ss[i].d<<" "<<profithere<<endl;
            maxprofit=profithere;
            ans1=ascore;
            ans2=bscore;
        }
    }
    cout<<ans1<<":"<<ans2;
    return 0;
}


#include<bits/stdc++.h>
#define pn() printf("\n")
#define si(x) scanf("%d",&x)
#define pi(x) printf("%d\n",x)
#define sc(x) scanf("%c",&x)
#define pc(x) printf("%c",x)
#define sf(x) scanf("%f",&x)
#define pf(x) printf("%f\n",x)
#define sd(x) scanf("%lf",&x)
#define pd(x) printf("%.7lf\n",x)
#define sld(x) scanf("%Lf",&x)
#define pld(x) printf("%.9Lf\n",x)
#define MOD 1000000007
#define ll long long
using namespace std;
struct st{
    int d;
    char type;
}ss[500001];
bool operator < (st a,st b){
    return a.d<b.d;
}
int idx=1;
int main(void){
    int n;
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>ss[idx].d;
        ss[idx].type='a';
        idx++;
    }
    int m;
    cin>>m;
    for(int i=1;i<=m;i++){
        cin>>ss[idx].d;
        ss[idx].type='b';
        idx++;
    }
    sort(ss+1,ss+idx);
    int maxprofit=3*n-3*m;
    int ans1=3*n,ans2=3*m;
    int acnt=0,bcnt=0;
    int save;
    //cout<<ans1<<" "<<ans2<<endl;
    for(int i=1;i<idx;i++){
        if(ss[i].type=='a'){
            acnt++;
        }
        else{
            bcnt++;
        }
        if(i<idx-1&&ss[i].d==ss[i+1].d){
            continue;
        }
        int ascore=2*acnt+3*(n-acnt);
        int bscore=2*bcnt+3*(m-bcnt);
        int profithere=ascore-bscore;
        if(profithere>maxprofit){
            save=ss[i].d;
            //cout<<"hello:"<<ss[i].d<<" "<<profithere<<endl;
            maxprofit=profithere;
            ans1=ascore;
            ans2=bscore;
        }
    }
    if(maxprofit<2*n-2*m){
        maxprofit=2*n-2*m;
        ans1=2*n;
        ans2=2*m;
    }
//    if(ans1==551013){
//        cout<<save<<endl;
//    }
    cout<<ans1<<":"<<ans2;
    return 0;
}


#include<bits/stdc++.h>
#define pn() printf("\n")
#define si(x) scanf("%d",&x)
#define pi(x) printf("%d\n",x)
#define sc(x) scanf("%c",&x)
#define pc(x) printf("%c",x)
#define sf(x) scanf("%f",&x)
#define pf(x) printf("%f\n",x)
#define sd(x) scanf("%lf",&x)
#define pd(x) printf("%.7lf\n",x)
#define sld(x) scanf("%Lf",&x)
#define pld(x) printf("%.9Lf\n",x)
#define MOD 1000000007
#define ll long long
using namespace std;
struct st{
    int d;
    char type;
}ss[500001];
bool operator < (st a,st b){
    return a.d<b.d;
}
int idx=1;
int main(void){
    int n;
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>ss[idx].d;
        ss[idx].type='a';
        idx++;
    }
    int m;
    cin>>m;
    for(int i=1;i<=m;i++){
        cin>>ss[idx].d;
        ss[idx].type='b';
        idx++;
    }
    sort(ss+1,ss+idx);
    int maxprofit=3*n-3*m;
    int ans1=3*n,ans2=3*m;
    int acnt=0,bcnt=0;
    int save;
    //cout<<ans1<<" "<<ans2<<endl;
    for(int i=1;i<idx;i++){
        if(ss[i].type=='a'){
            acnt++;
        }
        else{
            bcnt++;
        }
        if(i<idx+1&&ss[i].d==ss[i+1].d){
            i++;
            continue;
        }
        int ascore=2*acnt+3*(n-acnt);
        int bscore=2*bcnt+3*(m-bcnt);
        int profithere=ascore-bscore;
        if(profithere>maxprofit){
            save=ss[i].d;
            //cout<<"hello:"<<ss[i].d<<" "<<profithere<<endl;
            maxprofit=profithere;
            ans1=ascore;
            ans2=bscore;
        }
    }
    if(maxprofit<2*n-2*m){
        maxprofit=2*n-2*m;
        ans1=2*n;
        ans2=2*m;
    }
    if(ans1==551013){
        cout<<save<<endl;
    }
    cout<<ans1<<":"<<ans2;
    return 0;
}


#include<bits/stdc++.h>
#define pn() printf("\n")
#define si(x) scanf("%d",&x)
#define pi(x) printf("%d\n",x)
#define sll(x) scanf("%lld",&x)
#define pll(x) printf("%lld\n",x)
#define sc(x) scanf("%c",&x)
#define pc(x) printf("%c",x)
#define sf(x) scanf("%f",&x)
#define pf(x) printf("%f\n",x)
#define sd(x) scanf("%lf",&x)
#define pd(x) printf("%.7lf\n",x)
#define sld(x) scanf("%Lf",&x)
#define pld(x) printf("%.9Lf\n",x)
#define MOD 1000000007
#define ll long long
using namespace std;
struct st{
    int d;
    char type;
}ss[500001];
bool operator < (st a,st b){
    return a.d<b.d;
}
int idx=1;
int main(void){
    int n;
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>ss[idx].d;
        ss[idx].type='a';
        idx++;
    }
    int m;
    cin>>m;
    for(int i=1;i<=m;i++){
        cin>>ss[idx].d;
        ss[idx].type='b';
        idx++;
    }
    sort(ss+1,ss+idx);
//    for(int i=1;i<idx;i++){
//        cout<<ss[i].d<<endl;
//    }
    int maxprofit=3*n-3*m;
    int ans1=3*n,ans2=3*m;
    if(maxprofit<2*n-2*m){
        maxprofit=2*n-2*m;
        ans1=2*n;
        ans2=3*m;
    }
    int acnt=0,bcnt=0;
    int save;
    //cout<<ans1<<" "<<ans2<<endl;
    for(int i=1;i<idx;i++){
        if(ss[i].type=='a'){
            acnt++;
        }
        else{
            bcnt++;
        }
        int ascore=2*acnt+3*(n-acnt);
        int bscore=2*bcnt+3*(m-bcnt);
        int profithere=ascore-bscore;
        if(profithere>maxprofit){
            save=ss[i].d;
            //cout<<"hello:"<<ss[i].d<<" "<<profithere<<endl;
            maxprofit=profithere;
            ans1=ascore;
            ans2=bscore;
        }
    }
    if(n==50000){
        cout<<save<<endl;
    }
    cout<<ans1<<":"<<ans2;
    return 0;
}


#include<bits/stdc++.h>
#define pn() printf("\n")
#define si(x) scanf("%d",&x)
#define pi(x) printf("%d\n",x)

#define sc(x) scanf("%c",&x)
#define pc(x) printf("%c",x)
#define sf(x) scanf("%f",&x)
#define pf(x) printf("%f\n",x)
#define sd(x) scanf("%lf",&x)
#define pd(x) printf("%.7lf\n",x)
#define sld(x) scanf("%Lf",&x)
#define pld(x) printf("%.9Lf\n",x)
#define MOD 1000000007
#define ll long long
using namespace std;
struct st{
    int d;
    char type;
}ss[500001];
bool operator < (st a,st b){
    return a.d<b.d;
}
int idx=1;
int main(void){
    int n;
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>ss[idx].d;
        ss[idx].type='a';
        idx++;
    }
    int m;
    cin>>m;
    for(int i=1;i<=m;i++){
        cin>>ss[idx].d;
        ss[idx].type='b';
        idx++;
    }
    sort(ss+1,ss+idx);
//    for(int i=1;i<idx;i++){
//        cout<<ss[i].d<<endl;
//    }
    int maxprofit=3*n-3*m;
    int ans1=3*n,ans2=3*m;
    if(maxprofit<2*n-2*m){
        maxprofit=2*n-2*m;
        ans1=2*n;
        ans2=3*m;
    }
    int acnt=0,bcnt=0;
    int save;
    //cout<<ans1<<" "<<ans2<<endl;
    for(int i=1;i<idx;i++){
        if(ss[i].type=='a'){
            acnt++;
        }
        else{
            bcnt++;
        }
        if(i<idx+1&&ss[i].d==ss[i+1].d){
            i++;
            continue;
        }
        int ascore=2*acnt+3*(n-acnt);
        int bscore=2*bcnt+3*(m-bcnt);
        int profithere=ascore-bscore;
        if(profithere>maxprofit){
            save=ss[i].d;
            //cout<<"hello:"<<ss[i].d<<" "<<profithere<<endl;
            maxprofit=profithere;
            ans1=ascore;
            ans2=bscore;
        }
    }
    if(n==50000){
        //cout<<save<<endl;
    }
    cout<<ans1<<":"<<ans2;
    return 0;
}


#include<bits/stdc++.h>
#define pn() printf("\n")
#define si(x) scanf("%d",&x)
#define pi(x) printf("%d\n",x)
#define sc(x) scanf("%c",&x)
#define pc(x) printf("%c",x)
#define sf(x) scanf("%f",&x)
#define pf(x) printf("%f\n",x)
#define sd(x) scanf("%lf",&x)
#define pd(x) printf("%.7lf\n",x)
#define sld(x) scanf("%Lf",&x)
#define pld(x) printf("%.9Lf\n",x)
#define MOD 1000000007
#define ll long long
using namespace std;
struct st{
    int d;
    char type;
}ss[500001];
bool operator < (st a,st b){
    return a.d<b.d;
}
int idx=1;
int main(void){
    int n;
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>ss[idx].d;
        ss[idx].type='a';
        idx++;
    }
    int m;
    cin>>m;
    for(int i=1;i<=m;i++){
        cin>>ss[idx].d;
        ss[idx].type='b';
        idx++;
    }
    sort(ss+1,ss+idx);
    int maxprofit=3*n-3*m;
    int ans1=3*n,ans2=3*m;
    int acnt=0,bcnt=0;
    int save;
    //cout<<ans1<<" "<<ans2<<endl;
    for(int i=1;i<idx;i++){
        if(ss[i].type=='a'){
            acnt++;
        }
        else{
            bcnt++;
        }
        if(i<idx-1&&ss[i].d==ss[i+1].d){
            i++;
            continue;
        }
        int ascore=2*acnt+3*(n-acnt);
        int bscore=2*bcnt+3*(m-bcnt);
        int profithere=ascore-bscore;
        if(profithere>maxprofit){
            save=ss[i].d;
            //cout<<"hello:"<<ss[i].d<<" "<<profithere<<endl;
            maxprofit=profithere;
            ans1=ascore;
            ans2=bscore;
        }
    }
    if(maxprofit<2*n-2*m){
        maxprofit=2*n-2*m;
        ans1=2*n;
        ans2=2*m;
    }
//    if(ans1==551013){
//        cout<<save<<endl;
//    }
    cout<<ans1<<":"<<ans2;
    return 0;
}