#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<iostream>
#include<set>
#include<algorithm>
using namespace std;
const int maxn = 1e4 + 10;
double abs(double mm)
{
   if(mm < 0.0)
        mm = -mm;
   return mm;
}
int main()
{
	int b,q,l,m;
	scanf("%d%d%d%d",&b,&q,&l,&m);
	set<int > S;
	S.clear();
	for(int i = 0; i < m; i++)
    {
        int x;
        scanf("%d",&x);
        S.insert(x);
    }
	if(q == 0)
    {
         if((S.find(b) == S.end() && S.find(0) != S.end() && abs(b) <= l))
                printf("1\n");
         else if((S.find(b) != S.end() && S.find(0) != S.end()) || abs(b) > l)
            printf("0\n");
         else
            printf("inf\n");
    }
    else if(abs(q) == 1)
    {
        if(q == 1)
        {
            if(S.find(b) == S.end() && abs(b) <= l)
                printf("inf\n");
            else
                printf("0\n");
        }
        else
        {
             if((S.find(b) == S.end() && abs(b) <= l) || (S.find(-b) == S.end() && abs(b) <= l))
                printf("inf\n");
             else
                printf("0\n");
        }
    }
    else
    {
        if(b == 0)
        {
            if(S.find(0) == S.end())
                printf("1\n");
            else
                printf("0\n");
        }
        else{
            int ans = 0;
            while(abs(b) <= l)
            {
                if(S.find(b) == S.end())
                    ans++;//cout << ans++ << endl;
                b = b * q;
                //cout << b << " " << ans << endl;
            }
            printf("%d\n",ans);
        }

    }
	return 0;
}


#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<iostream>
#include<set>
#include<algorithm>
using namespace std;
const int maxn = 1e4 + 10;
double abs(double mm)
{
   if(mm < 0.0)
        mm = -mm;
   return mm;
}
int main()
{
	int b,q,l,m;
	scanf("%d%d%d%d",&b,&q,&l,&m);
	set<int > S;
	S.clear();
	for(int i = 0; i < m; i++)
    {
        int x;
        scanf("%d",&x);
        S.insert(x);
    }
	if(q == 0)
    {
         if((S.find(b) != S.end() && S.find(0) == S.end() && abs(b) <= l))
                printf("1\n");
         else if(S.find(b) != S.end() && S.find(0) != S.end())
            printf("0\n");
         else
            printf("inf\n");
    }
    else if(abs(q) == 1)
    {
        if(q == 1)
        {
            if(S.find(b) == S.end() && abs(b) <= l)
                printf("inf\n");
            else
                printf("0\n");
        }
        else
        {
             if((S.find(b) != S.end() && S.find(-b) == S.end() && abs(b) <= l) || (S.find(-b) != S.end() && S.find(b) == S.end() && abs(b) <= l))
                printf("1\n");
             else if(S.find(b) != S.end() && S.find(-b) != S.end() && abs(b) <= l)
                printf("0\n");
             else if(S.find(b) == S.end() && S.find(-b) == S.end() && abs(b) <= l)
                printf("2\n");
             else
                printf("inf\n");
        }
    }
    else
    {
        int ans = 0;
        while(abs(b) <= l)
        {
            if(S.find(b) == S.end())
                ans++;//cout << ans++ << endl;
            b = b * q;
            //cout << b << " " << ans << endl;
        }
        printf("%d\n",ans);
    }
	return 0;
}


#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<iostream>
#include<set>
#include<algorithm>
using namespace std;
const int maxn = 1e4 + 10;
double abs(double mm)
{
   if(mm < 0.0)
        mm = -mm;
   return mm;
}
int main()
{
	int b,q,l,m;
	scanf("%d%d%d%d",&b,&q,&l,&m);
	set<int > S;
	S.clear();
	for(int i = 0; i < m; i++)
    {
        int x;
        scanf("%d",&x);
        S.insert(x);
    }
	if(q == 0)
    {
        if(abs(b) <= l && S.find(b) == S.end())
            printf("1\n");
        else
            printf("0\n");
    }
    else if(abs(q) == 1)
    {
        if(q == 1)
        {
            if(S.find(b) == S.end() && abs(b) <= l)
                printf("inf\n");
            else
                printf("0\n");
        }
        else
        {
             if((S.find(b) != S.end() && S.find(-b) == S.end() && abs(b) <= l) || (S.find(-b) != S.end() && S.find(b) == S.end() && abs(b) <= l))
                printf("1\n");
             else if(S.find(b) != S.end() && S.find(-b) != S.end() && abs(b) <= l)
                printf("0\n");
             else if(S.find(b) == S.end() && S.find(-b) == S.end() && abs(b) <= l)
                printf("2\n");
             else
                printf("inf\n");
        }
    }
    else
    {
        int ans = 0;
        while(abs(b) <= l)
        {
            if(S.find(b) == S.end())
                ans++;//cout << ans++ << endl;
            b = b * q;
            //cout << b << " " << ans << endl;
        }
        printf("%d\n",ans);
    }
	return 0;
}


#include <cstdio>
#include <cstdlib>

long long b , q , l , m , n , x , i , nula_je_los , negativan_je_los , los , A[100001];

int main()
{
	scanf("%I64d%I64d%I64d%I64d" , &b , &q , &l , &m);
	nula_je_los = 0;
	negativan_je_los = 0;
	los = 0;
	for (i = 1;i <= m;++i)
	{
		scanf("%I64d" , &A[i]);
		if (0 == A[i]) nula_je_los = 1;
		if (b == A[i]) los = 1;
		if (-b == A[i]) negativan_je_los = 1;
	}
	if (abs(b) > l) printf("0"); else
	if (b == 0)
	{
		if (nula_je_los) printf("0"); else printf("inf");
	} else
	{
		if (q == 1)
		{
			if (los) printf("0"); else printf("inf");
		} else
		if (q == 0)
		{
			if (nula_je_los) printf("1"); else printf("inf");
		} else
		if (q == -1)
		{
			if ((los) && (negativan_je_los)) printf("0"); else printf("inf");
		} else
		{
			n = 1;
			while (abs(b) <= l)
			{
				b *= q;
				if (abs(b) > l) break;
				x = 0;
				for (i = 1;i <= n;++i) if (b == A[i]) x = -1;
				n += x + 1;
			}
			printf("%I64d" , n);
		}
	}
	return 0;
}


#include <cstdio>
#include <cstdlib>

long long b , q , l , nula_je_los , prvi_je_los , x , n , m , i , A[100001];

int main()
{
	scanf("%I64d%I64d%I64d%I64d" , &b , &q , &l , &m);
	prvi_je_los = 0;
	nula_je_los = 0;
	for (i = 1;i <= m;++i)
	{
		scanf("%I64d" , &A[i]);
		if (b == A[i]) prvi_je_los = 1;
		if (0 == A[i]) nula_je_los = 1;
	}
	if (b != 0)
	{
		if (abs(b) > l) printf("0");
		if (((q == -1) || (q == 1)) && (abs(b) <= l))
		{
			if (prvi_je_los) printf("0");
			if (!(prvi_je_los)) printf("inf");
		}
		if ((q == 0) && (abs(b) <= l))
		{
			if (prvi_je_los) printf("0");
			if ((!(prvi_je_los)) && (nula_je_los)) printf("1");
			if ((!(prvi_je_los)) && (!(nula_je_los))) printf("inf");
		}
		if (((q <= -2) || (q >= 2)) && (abs(b) <= l))
		{
			n = 0;
			while (abs(b) <= l)
			{
				x = 0;
				for (i = 1;i <= m;++i) if (b == A[i]) x = -1;
				b *= q;
				n += x + 1;
			}
			printf("%I64d" , n);
		}
	}
	if (b == 0)
	{
		if (nula_je_los) printf("0");
		if (!(nula_je_los)) printf("inf");
	}
	return 0;
}


#include <cstdio>
#include <cstdlib>

long long b , q , l , m , n , x , i , nula_je_los , negativan_je_los , los , A[100001];

int main()
{
	scanf("%I64d%I64d%I64d%I64d" , &b , &q , &l , &m);
	nula_je_los = 0;
	negativan_je_los = 0;
	los = 0;
	for (i = 1;i <= m;++i)
	{
		scanf("%I64d" , &A[i]);
		if (0 == A[i]) nula_je_los = 1;
		if (b == A[i]) los = 1;
		if (-b == A[i]) negativan_je_los = 1;
	}
	if (abs(b) > l) printf("0"); else
	if (b == 0)
	{
		if (nula_je_los) printf("0"); else printf("inf");
	} else
	{
		if (q == 1)
		{
			if (los) printf("0"); else printf("inf");
		} else
		if (q == 0)
		{
			if (nula_je_los) printf("1"); else printf("inf");
		} else
		if (q == -1)
		{
			if ((los) && (negativan_je_los)) printf("0"); else printf("inf");
		} else
		{
			if (los) n = 0; else n = 1;
			while (abs(b) <= l)
			{
				b *= q;
				if (abs(b) > l) break;
				x = 0;
				for (i = 1;i <= n;++i) if (b == A[i]) x = -1;
				n += x + 1;
			}
			printf("%I64d" , n);
		}
	}
	return 0;
}


#include <cstdio>
#include <cstdlib>

long long b , q , l , nula_je_los , prvi_je_los , x , n , m , i , A[100001];

int main()
{
	scanf("%I64d%I64d%I64d%I64d" , &b , &q , &l , &m);
	prvi_je_los = 0;
	nula_je_los = 0;
	for (i = 1;i <= m;++i)
	{
		scanf("%I64d" , &A[i]);
		if (b == A[i]) prvi_je_los = 1;
		if (0 == A[i]) nula_je_los = 1;
	}
	if (abs(b) > l) printf("0");
	if (((q == -1) || (q == 1)) && (abs(b) <= l))
	{
		if (prvi_je_los) printf("0");
		if (!(prvi_je_los)) printf("inf");
	}
	if ((q == 0) && (abs(b) <= l))
	{
		if (prvi_je_los) printf("0");
		if ((!(prvi_je_los)) && (nula_je_los)) printf("1");
		if ((!(prvi_je_los)) && (!(nula_je_los))) printf("inf");
	}
	if (((q <= -2) || (q >= 2)) && (abs(b) <= l))
	{
		n = 0;
		while (abs(b) <= l)
		{
			x = 0;
			for (i = 1;i <= m;++i) if (b == A[i]) x = -1;
			b *= q;
			n += x + 1;
		}
		printf("%I64d" , n);
	}
	return 0;
}


#include <cstdio>
#include <cstdlib>

long long b , q , l , nula_je_los , prvi_je_los , x , n , m , i , A[100001];

int main()
{
	scanf("%I64d%I64d%I64d%I64d" , &b , &q , &l , &m);
	prvi_je_los = 0;
	nula_je_los = 0;
	for (i = 1;i <= m;++i)
	{
		scanf("%I64d" , &A[i]);
		if (b == A[i]) prvi_je_los = 1;
		if (0 == A[i]) nula_je_los = 1;
	}
	if (abs(b) > l) printf("0");
	if ((q == -1) && (abs(b) <= l))
	{
		if (prvi_je_los) printf("0");
		if (!(prvi_je_los)) printf("inf");
	}
	if ((q == 0) && (abs(b) <= l))
	{
		if (nula_je_los) printf("1");
		if (!(nula_je_los)) printf("inf");
	}
	if ((q == 1) && (abs(b) <= l))
	{
		if (prvi_je_los) printf("0");
		if (!(prvi_je_los)) printf("inf");
	}
	if (((q <= -2) || (q >= 2)) && (abs(b) <= l))
	{
		n = 0;
		while (abs(b) <= l)
		{
			x = 0;
			for (i = 1;i <= m;++i) if (b == A[i]) x = -1;
			b *= q;
			n += x + 1;
		}
		printf("%I64d" , n);
	}
	return 0;
}


#include <cstdio>
#include <cstdlib>

long long b , q , l , m , n , x , i , nula_je_los , negativan_je_los , los , A[100001];

int main()
{
	scanf("%I64d%I64d%I64d%I64d" , &b , &q , &l , &m);
	nula_je_los = 0;
	negativan_je_los = 0;
	los = 0;
	for (i = 1;i <= m;++i)
	{
		scanf("%I64d" , &A[i]);
		if (0 == A[i]) nula_je_los = 1;
		if (b == A[i]) los = 1;
		if (-b == A[i]) negativan_je_los = 1;
	}
	if (abs(b) > l) printf("0"); else
	if (b == 0)
	{
		if (nula_je_los) printf("0"); else printf("inf");
	} else
	{
		if (q == 1)
		{
			if (los) printf("0"); else printf("inf");
		} else
		if (q == 0)
		{
			if (los) printf("0"); else
			if (nula_je_los) printf("1"); else
			printf("inf");
		} else
		if (q == -1)
		{
			if ((los) && (negativan_je_los)) printf("0"); else printf("inf");
		} else
		{
			if (los) n = 0; else n = 1;
			while (abs(b) <= l)
			{
				b *= q;
				if (abs(b) > l) break;
				x = 0;
				for (i = 1;i <= n;++i) if (b == A[i]) x = -1;
				n += x + 1;
			}
			printf("%I64d" , n);
		}
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;

#define sz(x) ((int)(x).size())
#define ms0(x) memset(x,0,sizeof(x))
#define ms1(x) memset(x,-1,sizeof(x))
#define max(a,b) (a>b?a:b)
#define min(a,b) (a<b?a:b)
#define f first
#define s second
#define mp make_pair
#define pb push_back
#define inf 1001001001
typedef pair<int,int> pii;
typedef long long ll;
typedef unsigned long long ull;
const double eps = 1e-9;
const double pi = acos(-1.0);
const int maxn = (int)1e5 + 10;
const int mod = (int)1e9;
vector<long long>v1,v2;
int main()
{
    long long i,j,a,b,x,n,m,il,iu,jl,ju,fmx,smx,ans1=0,ans2=0,mx=0;
    cin>>n;
    for(i=0;i<n;i++)
    {
        cin>>x;
        v1.pb(x);
    }
    cin>>m;
    for(i=0;i<m;i++)
    {
        cin>>x;
        v2.pb(x);
    }

    v1.pb(2000000009);
    v2.pb(2000000009);
    sort(v1.begin(),v1.end());
    sort(v2.begin(),v2.end());
    n++;m++;
    j=0;
    jl=j;
            while(v2[jl]==v2[j+1]&&j+1<m)
            {
                j++;
            }
            ju=j;
            i=0;
            il=i;
            while(v1[il]==v1[i+1]&&i+1<n)
            {
                i++;
            }
            iu=i;
    while(i<n-1||j<n-1)
    {
        a=v1[il];
        b=v2[jl];
        if(a<b)
        {
            fmx=il*2+(n-il-1)*3;
            smx=jl*2+(m-jl-1)*3;
            if(fmx-smx>=mx)
            {
                ans1=fmx;
                ans2=smx;
                mx=fmx-smx;
            }
            if(iu+1<n)
            i=iu+1;
            il=i;
            while(v1[il]==v1[i+1]&&i+1<n)
            {
                i++;
            }
            iu=i;
        }
        else if(b<a)
        {
            fmx=il*2+(n-il-1)*3;
            smx=jl*2+(m-jl-1)*3;
            if(fmx-smx>=mx)
            {
                ans1=fmx;
                ans2=smx;
                mx=fmx-smx;
            }
            if(ju+1<n)
            j=ju+1;
            jl=j;
            while(v2[jl]==v2[j+1]&&j+1<m)
            {
                j++;
            }
            ju=j;
        }
        else
        {
            fmx=il*2+(n-il-1)*3;
            smx=jl*2+(m-jl-1)*3;
            if(fmx-smx>=mx)
            {
                ans1=fmx;
                ans2=smx;
                mx=fmx-smx;
            }
            if(ju+1<n)
            j=ju+1;
            jl=j;
            while(v2[jl]==v2[j+1]&&j+1<m)
            {
                j++;
            }
            ju=j;
            if(iu+1<n)
            i=iu+1;
            il=i;
            while(v1[il]==v1[i+1]&&i+1<n)
            {
                i++;
            }
            iu=i;
        }
    }
    cout<<ans1<<":"<<ans2<<endl;

    return 0;
}


#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
int n1,n2;
int a[200005],b[200005];
int ans1,ans2;
int main()
{
    while(~scanf("%d",&n1))
    {
        int i,j,k,l;
        for(i=1; i<=n1; i++)
            scanf("%d",&a[i]);
        scanf("%d",&n2);
        for(i=0; i<n2; i++)
            scanf("%d",&b[i]);
        sort(b,b+n2);
        sort(a+1,a+n1+1);
        a[0]=a[1]-1;
        a[n1+1]=a[n1]+1;
        int ss1=-1,ss2;
        int d=-2000000000;
        for(i=0; i<=n1+1; i++)
        {
            int p=lower_bound(b,b+n2,a[i])-b;
            if(i==0)
                ans1=n1*3;
            else if(i==n1+1)
                ans1=n1*2;
            else
                ans1=(n1-i)*3+i*2;
            if(p==0)
                ans2=n2*3;
            else if(p==n2)
                ans2=n2*2;
            else
            ans2=(p)*2+(n2-p)*3;
            if(d<ans1-ans2)
            {
                d=ans1-ans2;
                ss1=ans1;
                ss2=ans2;
            }
        }
            printf("%d:%d\n",ss1,ss2);
        }
        return 0;
    }


#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
int n1,n2;
int a[200005],b[200005];
int ans1,ans2;
int main()
{
    while(~scanf("%d",&n1))
    {
        int i,j,k,l;
        for(i=0; i<n1; i++)
            scanf("%d",&a[i]);
        scanf("%d",&n2);
        for(i=0; i<n2; i++)
            scanf("%d",&b[i]);
        sort(b,b+n2);
        sort(a,a+n1);
        int ss1=-1,ss2;
        int d=-2000000000;
        for(i=0; i<=n1+1; i++)
        {
            int p=lower_bound(b,b+n2,a[i])-b;
            if(p==0)
            {
                ans2=n2*3;
                ans1=(n1-i)*3+i*2;
                if(d<ans1-ans2)
                {
                    d=ans1-ans2;
                    ss1=ans1;
                    ss2=ans2;
                }

            }
            else if(p==n2)
            {
                ans2=2*n2;
                ans1=i*2+3*(n1-i);
                if(d<ans1-ans2)
                {
                    d=ans1-ans2;
                    ss1=ans1;
                    ss2=ans2;
                }
            }
            else
            {
                ans1=i*2+3*(n1-i);
                ans2=p*2+(n2-p)*3;
                if(d<ans1-ans2)
                {
                    d=ans1-ans2;
                    ss1=ans1;
                    ss2=ans2;
                }
            }
        }
        if(d<2*n1-2*n2)
        {
            ss1=2*n1;
            ss2=2*n2;
        }
            printf("%d:%d\n",ss1,ss2);
        }
        return 0;
    }


#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
int n1,n2;
int a[200005],b[200005];
int ans1,ans2;
int main()
{
    while(~scanf("%d",&n1))
    {
        int i,j,k,l;
        for(i=0; i<n1; i++)
            scanf("%d",&a[i]);
        scanf("%d",&n2);
        for(i=0; i<n2; i++)
            scanf("%d",&b[i]);
        sort(b,b+n2);
        sort(a,a+n1);
        int ss1=-1,ss2;
        int d=0;
        for(i=0; i<=n1; i++)
        {
            int p=lower_bound(b,b+n2,a[n1-1])-b;
            ans1=(n1-i)*2+i*3;
            ans2=p*2+(n2-p)*3;
            if(d<ans1-ans2)
            {
                d=ans1-ans2;
                if(ss1<ans1)
                {
                ss1=ans1;
                ss2=ans2;
                }
            }
        }
            printf("%d:%d\n",ss1,ss2);
        }
        return 0;
    }


#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
int n1,n2;
int a[200005],b[200005];
int ans1,ans2;
int main()
{
    while(~scanf("%d",&n1))
    {
        int i,j,k,l;
        for(i=0;i<n1;i++)
            scanf("%d",&a[i]);
        scanf("%d",&n2);
        for(i=0;i<n2;i++)
            scanf("%d",&b[i]);
        sort(b,b+n2);
        sort(a,a+n1);
        int p=lower_bound(a,a+n1,b[n2-1])-a;
        if(p==n1)
        {
            ans1=3*n1;
            ans2=3*n2;
        }
        else
        {
            ans1=(n1-p)*3+p*2;
            ans2=2*n2;
        }
        printf("%d:%d\n",ans1,ans2);
    }
    return 0;
}


#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
int n1,n2;
int a[200005],b[200005];
int ans1,ans2;
int main()
{
    while(~scanf("%d",&n1))
    {
        int i,j,k,l;
        for(i=0; i<n1; i++)
            scanf("%d",&a[i]);
        scanf("%d",&n2);
        for(i=0; i<n2; i++)
            scanf("%d",&b[i]);
        sort(b,b+n2);
        sort(a,a+n1);
        int ss1=-1,ss2;
        int d=0;
        for(i=0; i<=n1; i++)
        {
            int p=lower_bound(b,b+n2,a[n1-1])-b;
            ans1=(n1-i)*3+i*2;
            ans2=p*2+(n2-p)*3;
            if(d<ans1-ans2)
            {
                d=ans1-ans2;
                if(ss1<ans1)
                {
                ss1=ans1;
                ss2=ans2;
                }
            }
        }
            printf("%d:%d\n",ss1,ss2);
        }
        return 0;
    }


#include<bits/stdc++.h>

using namespace std;
long long int a[1005*1005];
long long int b[1005*1005];
int main()
{
	int n;
	scanf("%d",&n);
	for(int i=0;i<n;i++)
	scanf("%I64d",&a[i]);
	int m;
	scanf("%d",&m);
	for(int i=0;i<m;i++)
	scanf("%I64d",&b[i]);

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

	int x=a[0];
	long long int ans1=n*3;
	long long int ans2=0;

	for(int i=0;i<m;i++)
	{
		if(b[i]<x)
		ans2+=2;

		else
		ans2+=3;
	}

	printf("%I64d:%I64d",ans1,ans2);
	return 0;
}


#include <bits/stdc++.h>

using namespace std;

vector <long long int> first;
vector <long long int> second;

int main(void)
{
	int n, m;
	long long int a, b, scoreA, scoreB, maxA, maxB, maxDiff;
	scanf("%d", &n);
	for(int i = 0; i < n; i++)
	{
		cin >> a;
		first.push_back(a);
	}
	first.push_back(2087654321);
	scanf("%d", &m);
	for(int i = 0; i < m; i++)
	{
		cin >> b;
		second.push_back(b);
	}
	second.push_back(2087654321);
	sort(first.begin(), first.end());
	sort(second.begin(), second.end());
	maxA = scoreA = 3 * n;
	maxB = scoreB = 3 * m;
	maxDiff = scoreA - scoreB;
	for(int i = 0, j = 0; i < n || j < m; )
	{
		if(first[i] < second[j])
		{
			scoreA -= 1;
			i++;
		}
		else if(first[i] > second[j])
		{
			scoreB -= 1;
			j++;
		}
		else
		{
			scoreA -= 1;
			scoreB -= 1;
			i++;
			j++;
		}
		if(scoreA - scoreB > maxDiff)
		{
			maxDiff = scoreA - scoreB;
			maxA = scoreA;
			maxB = scoreB;
		}
	}
	cout << maxA << ':' << maxB << endl;
	return 0;
}


#include<bits/stdc++.h>

using namespace std;
long long int a[1005*1005];
long long int b[1005*1005];
int main()
{
	int n;
	scanf("%d",&n);
	for(int i=0;i<n;i++)
	scanf("%I64d",&a[i]);
	int m;
	scanf("%d",&m);
	for(int i=0;i<m;i++)
	scanf("%I64d",&b[i]);

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

	int x=a[0];
	long long int ans1=n*3;
	long long int ans2=0;

	for(int i=0;i<m;i++)
	{
		if(b[i]<x)
		ans2+=2;

		else
		ans2+=3;
	}
	long long diff=ans1-ans2;
	if(m>n)
	{
		long long int diff2=n*2-m*2;
		if(diff2>diff1)
		{
			ans1=n*2;
			ans2=m*2;
		}

	}
	printf("%I64d:%I64d",ans1,ans2);
	return 0;
}


#include<bits/stdc++.h>

using namespace std;
long long int a[1005*1005];
long long int b[1005*1005];
int main()
{
	int n;
	scanf("%d",&n);
	memset(a,INT_MAX,sizeof(a));
	memset(b,INT_MAX,sizeof(b));
	for(int i=0;i<n;i++)
	scanf("%I64d",&a[i]);
	int m;
	scanf("%d",&m);
	for(int i=0;i<m;i++)
	scanf("%I64d",&b[i]);

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

	long long int ans1=3*n;
	long long int ans2=3*m;
	int ctr=0;
	//long long int max=INT_MIN;
	long long int answer1=ans1;
	long long int answer2=ans2;
	long long int diff=ans1-ans2;

	for(int i=0,j=0;i<n||j<m;)
	{
	  if(a[i]<b[j])
	  {
	  	i++;
	  	ans1=ans1-1;
	  }

	  else if(a[i]>b[j])
	  {
	  	j++;
	  	ans2=ans2-1;
	  }

	  else
	  {
	  	i++;
	  	j++;
	  	ans1=ans1-1;
	  	ans2=ans2-1;
	  }
	  if(diff<ans1-ans2)
	  {
	  	cout<<answer1<<" "<<answer2<<endl;
	  	answer1=ans1;
	  	answer2=ans2;
	  	diff=ans1-ans2;
	  }

	}
	printf("%I64d:%I64d",answer1,answer2);
	return 0;
}


#include<bits/stdc++.h>

using namespace std;
long long int a[1005*1005];
long long int b[1005*1005];
int main()
{
	int n;
	scanf("%d",&n);
	for(int i=0;i<n;i++)
	scanf("%I64d",&a[i]);
	int m;
	scanf("%d",&m);
	for(int i=0;i<m;i++)
	scanf("%I64d",&b[i]);

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

	int x=a[0];
	long long int ans1=n*3;
	long long int ans2=0;
	for(int i=0;i<m;i++)
	{
		if(b[i]<=x)
		ans2+=2;

		else
		ans2+=3;
	}

	printf("%I64d:%I64d",ans1,ans2);
	return 0;
}


#include<bits/stdc++.h>

using namespace std;
vector<long long int>a;
vector<long long int>b;
int main()
{
	int n;
	scanf("%d",&n);
	//memset(a,INT_MAX,sizeof(a));
	//memset(b,INT_MAX,sizeof(b));

	long long int num1,num2;
	for(int i=0;i<n;i++)
	{
	scanf("%I64d",&num1);
	a.push_back(num1);
	}
    a.push_back(2087654321);
	int m;
	scanf("%d",&m);

	for(int i=0;i<m;i++)
	{
		scanf("%I64d",&num2);
		b.push_back(num2);
	}
	b.push_back(2087654321);
	sort(a.begin(),a.end());
	sort(b.begin(),b.end());

	long long int ans1=3*n;
	long long int ans2=3*m;
	int ctr=0;
	//long long int max=INT_MIN;
	long long int answer1=ans1;
	long long int answer2=ans2;
	long long int diff=ans1-ans2;

	for(int i=0,j=0;i<n||j<m;)
	{
	  if(a[i]<b[j])
	  {
	  	i++;
	  	ans1=ans1-1;
	  }

	  else if(a[i]>b[j])
	  {
	  	j++;
	  	ans2=ans2-1;
	  }

	  else
	  {
	  	i++;
	  	j++;
	  	ans1=ans1-1;
	  	ans2=ans2-1;
	  }
	  if(diff<ans1-ans2)
	  {
	  	//cout<<answer1<<" "<<answer2<<endl;
	  	answer1=ans1;
	  	answer2=ans2;
	  	diff=ans1-ans2;
	  }

	}
	printf("%I64d:%I64d",answer1,answer2);
	return 0;
}


#include<bits/stdc++.h>

using namespace std;
long long int a[1005*1005];
long long int b[1005*1005];
int main()
{
	int n;
	scanf("%d",&n);
	for(int i=0;i<n;i++)
	scanf("%I64d",&a[i]);
	int m;
	scanf("%d",&m);
	for(int i=0;i<m;i++)
	scanf("%I64d",&b[i]);

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

	long long int ans1=0;
	long long int ans2=0;
	int ctr=0;
	long long int max=INT_MIN;
	long long int answer1;
	long long int answer2;
	while(ctr<n)
	{
      ans1=0;
      ans2=0;
	  ans1=ctr*2+(n-ctr)*3;
	  int x=a[ctr];
	  for(int i=0;i<m;i++)
	  {
		if(b[i]<=x)
		ans2+=2;

		else
		ans2+=3;
	  }

	  if(max<ans1-ans2)
	  {
	  	max=ans1-ans2;
	  	answer1=ans1;
	  	answer2=ans2;
	  }
	  ctr++;
	}
	long long diff1=answer1-answer2;
	if(m>n)
	{
		long long int diff2=n*2-m*2;
		if(diff2>diff1)
		{
			answer1=n*2;
			answer2=m*2;
		}

	}
	printf("%I64d:%I64d",answer1,answer2);
	return 0;
}


#include<bits/stdc++.h>

using namespace std;
long long int a[1005*1005];
long long int b[1005*1005];
int main()
{
	int n;
	scanf("%d",&n);
	memset(a,INT_MAX,sizeof(a));
	memset(b,INT_MAX,sizeof(b));
	for(int i=0;i<n;i++)
	scanf("%I64d",&a[i]);
	int m;
	scanf("%d",&m);
	for(int i=0;i<m;i++)
	scanf("%I64d",&b[i]);

	sort(a,a+n);

	sort(b,b+m);

	long long int ans1=3*n;
	long long int ans2=3*m;
	int ctr=0;
	//long long int max=INT_MIN;
	long long int answer1=ans1;
	long long int answer2=ans2;
	long long int diff=ans1-ans2;

	for(int i=0,j=0;i<n||j<m;)
	{
	  if(a[i]<b[j])
	  {
	  	i++;
	  	ans1=ans1-1;
	  }

	  else if(a[i]>b[j])
	  {
	  	j++;
	  	ans2=ans2-1;
	  }

	  else
	  {
	  	i++;
	  	j++;
	  	ans1=ans1-1;
	  	ans2=ans2-1;
	  }
	  if(diff<ans1-ans2)
	  {
	  	//cout<<answer1<<" "<<answer2<<endl;
	  	answer1=ans1;
	  	answer2=ans2;
	  	diff=ans1-ans2;
	  }

	}
	printf("%I64d:%I64d",answer1,answer2);
	return 0;
}


#include<bits/stdc++.h>

using namespace std;
long long int a[1005*1005];
long long int b[1005*1005];
int main()
{
	int n;
	scanf("%d",&n);
	for(int i=0;i<n;i++)
	scanf("%I64d",&a[i]);
	int m;
	scanf("%d",&m);
	for(int i=0;i<m;i++)
	scanf("%I64d",&b[i]);

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

	int x=a[0];
	long long int ans1=n*3;
	long long int ans2=0;

	for(int i=0;i<m;i++)
	{
		if(b[i]<=x)
		ans2+=2;

		else
		ans2+=3;
	}

	printf("%I64d:%I64d",ans1,ans2);
	return 0;
}


#include<bits/stdc++.h>

using namespace std;
long long int a[1005*1005];
long long int b[1005*1005];
int main()
{
	int n;
	scanf("%d",&n);
	for(int i=0;i<n;i++)
	scanf("%I64d",&a[i]);
	int m;
	scanf("%d",&m);
	for(int i=0;i<m;i++)
	scanf("%I64d",&b[i]);

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

	long long int ans1=3*n;
	long long int ans2=3*m;
	int ctr=0;
	//long long int max=INT_MIN;
	long long int answer1=ans1;
	long long int answer2=ans2;
	long long int diff=ans1-ans2;

	for(int i=0,j=0;i<n||j<m;)
	{
	  if(a[i]<b[j])
	  {
	  	i++;
	  	ans1=ans1-1;
	  }

	  else if(a[i]>b[j])
	  {
	  	j++;
	  	ans2=ans2-1;
	  }

	  else
	  {
	  	i++;
	  	j++;
	  	ans1=ans1-1;
	  	ans2=ans2-1;
	  }
	  if(diff<ans1-ans2)
	  {
	  	answer1=ans1;
	  	answer2=ans2;
	  	diff=ans1-ans2;
	  }

	}
	printf("%I64d:%I64d",answer1,answer2);
	return 0;
}


#include<bits/stdc++.h>

using namespace std;
long long int a[1005*1005];
long long int b[1005*1005];
int main()
{
	int n;
	scanf("%d",&n);
	for(int i=0;i<n;i++)
	scanf("%I64d",&a[i]);
	int m;
	scanf("%d",&m);
	for(int i=0;i<m;i++)
	scanf("%I64d",&b[i]);

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

	int x=a[0];
	long long int ans1=n*3;
	long long int ans2=0;

	for(int i=0;i<m;i++)
	{
		if(b[i]<x)
		ans2+=2;

		else
		ans2+=3;
	}
	long long diff1=ans1-ans2;
	if(m>n)
	{
		long long int diff2=n*2-m*2;
		if(diff2>diff1)
		{
			ans1=n*2;
			ans2=m*2;
		}

	}
	printf("%I64d:%I64d",ans1,ans2);
	return 0;
}


#include<bits/stdc++.h>

using namespace std;
vector<long long int>a;
vector<long long int>b;
int main()
{
	int n;
	scanf("%d",&n);
	//memset(a,INT_MAX,sizeof(a));
	//memset(b,INT_MAX,sizeof(b));
	a.push_back(999999999);
	int num;
	for(int i=0;i<n;i++)
	{
	scanf("%I64d",&num);
	a.push_back(num);
	}

	int m;
	scanf("%d",&m);
	b.push_back(999999999);

	for(int i=0;i<m;i++)
	{
		scanf("%I64d",&num);
		b.push_back(num);
	}
	sort(a.begin(),a.end());
	sort(b.begin(),b.end());

	long long int ans1=3*n;
	long long int ans2=3*m;
	int ctr=0;
	//long long int max=INT_MIN;
	long long int answer1=ans1;
	long long int answer2=ans2;
	long long int diff=ans1-ans2;

	for(int i=0,j=0;i<n||j<m;)
	{
	  if(a[i]<b[j])
	  {
	  	i++;
	  	ans1=ans1-1;
	  }

	  else if(a[i]>b[j])
	  {
	  	j++;
	  	ans2=ans2-1;
	  }

	  else
	  {
	  	i++;
	  	j++;
	  	ans1=ans1-1;
	  	ans2=ans2-1;
	  }
	  if(diff<ans1-ans2)
	  {
	  	//cout<<answer1<<" "<<answer2<<endl;
	  	answer1=ans1;
	  	answer2=ans2;
	  	diff=ans1-ans2;
	  }

	}
	printf("%I64d:%I64d",answer1,answer2);
	return 0;
}


#include<bits/stdc++.h>

using namespace std;
vector<long long int>a;
vector<long long int>b;
int main()
{
	int n;
	scanf("%d",&n);
	//memset(a,INT_MAX,sizeof(a));
	//memset(b,INT_MAX,sizeof(b));
	a.push_back(INT_MAX);
	int num;
	for(int i=0;i<n;i++)
	{
	scanf("%I64d",&num);
	a.push_back(num);
	}

	int m;
	scanf("%d",&m);
	b.push_back(INT_MAX);

	for(int i=0;i<m;i++)
	{
		scanf("%I64d",&num);
		b.push_back(num);
	}
	sort(a.begin(),a.end());
	sort(b.begin(),b.end());

	long long int ans1=3*n;
	long long int ans2=3*m;
	int ctr=0;
	//long long int max=INT_MIN;
	long long int answer1=ans1;
	long long int answer2=ans2;
	long long int diff=ans1-ans2;

	for(int i=0,j=0;i<n||j<m;)
	{
	  if(a[i]<b[j])
	  {
	  	i++;
	  	ans1=ans1-1;
	  }

	  else if(a[i]>b[j])
	  {
	  	j++;
	  	ans2=ans2-1;
	  }

	  else
	  {
	  	i++;
	  	j++;
	  	ans1=ans1-1;
	  	ans2=ans2-1;
	  }
	  if(diff<ans1-ans2)
	  {
	  	//cout<<answer1<<" "<<answer2<<endl;
	  	answer1=ans1;
	  	answer2=ans2;
	  	diff=ans1-ans2;
	  }

	}
	printf("%I64d:%I64d",answer1,answer2);
	return 0;
}


#include<bits/stdc++.h>

using namespace std;
long long int a[1005*1005];
long long int b[1005*1005];
int main()
{
	int n;
	scanf("%d",&n);
	memset(a,INT_MAX,sizeof(a));
	memset(b,INT_MAX,sizeof(b));
	for(int i=0;i<n;i++)
	scanf("%I64d",&a[i]);
	int m;
	scanf("%d",&m);
	for(int i=0;i<m;i++)
	scanf("%I64d",&b[i]);

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

	long long int ans1=3*n;
	long long int ans2=3*m;
	int ctr=0;
	//long long int max=INT_MIN;
	long long int answer1=ans1;
	long long int answer2=ans2;
	long long int diff=ans1-ans2;

	for(int i=0,j=0;i<n||j<m;)
	{
	  if(a[i]<b[j])
	  {
	  	i++;
	  	ans1=ans1-1;
	  }

	  else if(a[i]>b[j])
	  {
	  	j++;
	  	ans2=ans2-1;
	  }

	  else
	  {
	  	i++;
	  	j++;
	  	ans1=ans1-1;
	  	ans2=ans2-1;
	  }
	  if(diff<ans1-ans2)
	  {
	  	//cout<<answer1<<" "<<answer2<<endl;
	  	answer1=ans1;
	  	answer2=ans2;
	  	diff=ans1-ans2;
	  }

	}
	printf("%I64d:%I64d",answer1,answer2);
	return 0;
}


#include<iostream>
#include<cstdio>
#include<cstring>
#include<queue>
#include<vector>
#include<cmath>
#include<algorithm>
#include<stack>
#include<map>
#include<set>
using namespace std;

#define LL long long

const int maxn = 2*100000+20;

int a[maxn];
int b[maxn];
int all[maxn];
int n,m;
int main()
{
	cin>>n;
	int cnt = 0;
	for(int i=0;i<n;i++) {
		cin>>a[i];
		all[cnt++] = a[i];
	}
	cin>>m;
	for(int i=0;i<m;i++) {
		cin>>b[i];
		all[cnt++] = b[i];
	}
	sort(a,a+n);
	sort(b,b+m);
	sort(all,all+cnt);
	long long a1,b1;
	a1 = -2*1000000000;
	b1 = -a1;
	for(int i=0;i<cnt;i++) {
		int tmp = all[i]-1;
		LL p1 = upper_bound(a,a+n,tmp) - a;
		LL p2 = upper_bound(b,b+m,tmp) - b;
		long long sum1 = 2*p1 + 3*(n-p1);
		long long sum2 = 2*p2 + 3*(m-p2);
		if(sum1-sum2 > a1-b1) {
			a1 = sum1;
			b1 = sum2;
		}
		else if(sum1 - sum2 == a1 - b1) {
			if(sum1 > a1) {
				a1 = sum1;
				b1 = sum2;
			}
		}
		tmp = all[i]+1;
		p1 = upper_bound(a,a+n,tmp) - a;
		p2 = upper_bound(b,b+m,tmp) - b;
		sum1 = 2*p1 + 3*(n-p1);
		sum2 = 2*p2 + 3*(m-p2);
		if(sum1-sum2 > a1-b1) {
			a1 = sum1;
			b1 = sum2;
		}
		else if(sum1 - sum2 == a1 - b1) {
			if(sum1 > a1) {
				a1 = sum1;
				b1 = sum2;
			}
		}
	}
	cout<<a1<<":"<<b1<<endl;
	return 0;
}


#include<iostream>
#include<cstdio>
#include<cstring>
#include<queue>
#include<vector>
#include<cmath>
#include<algorithm>
#include<stack>
#include<map>
#include<set>
using namespace std;

#define LL long long

const int maxn = 2*100000+20;

int a[maxn];
int b[maxn];
int all[maxn];
int n,m;
int main()
{
	cin>>n;
	int cnt = 0;
	for(int i=0;i<n;i++) {
		cin>>a[i];
		all[cnt++] = a[i];
	}
	cin>>m;
	for(int i=0;i<m;i++) {
		cin>>b[i];
		all[cnt++] = b[i];
	}
	sort(a,a+n);
	sort(b,b+m);
	sort(all,all+cnt);
	long long a1,b1;
	a1 = -2*1000000000;
	b1 = -a1;
	for(int i=0;i<cnt;i++) {
		int tmp = all[i]-1;
		LL p1 = upper_bound(a,a+n,tmp) - a;
		LL p2 = upper_bound(b,b+m,tmp) - b;
		long long sum1 = 2*p1 + 3*(n-p1);
		long long sum2 = 2*p2 + 3*(m-p2);
		if(sum1-sum2 > a1-b1) {
			a1 = sum1;
			b1 = sum2;
		}
		else if(sum1 - sum2 == a1 - b1) {
			if(sum1 > a1) {
				a1 = sum1;
				b1 = sum2;
			}
		}
		tmp = all[i];
		p1 = upper_bound(a,a+n,tmp) - a;
		p2 = upper_bound(b,b+m,tmp) - b;
		sum1 = 2*p1 + 3*(n-p1);
		sum2 = 2*p2 + 3*(m-p2);
		if(sum1-sum2 > a1-b1) {
			a1 = sum1;
			b1 = sum2;
		}
		else if(sum1 - sum2 == a1 - b1) {
			if(sum1 > a1) {
				a1 = sum1;
				b1 = sum2;
			}
		}
	}
	cout<<a1<<":"<<b1<<endl;
	return 0;
}


#include<iostream>
#include<cstdio>
#include<cstring>
#include<queue>
#include<vector>
#include<cmath>
#include<algorithm>
#include<stack>
#include<map>
#include<set>
using namespace std;

#define LL long long

const int maxn = 2*100000+20;

int a[maxn];
int b[maxn];
int all[maxn];
int n,m;
int main()
{
	cin>>n;
	int cnt = 0;
	all[cnt++] = 0;
	for(int i=0;i<n;i++) {
		cin>>a[i];
		all[cnt++] = a[i];
	}
	cin>>m;
	for(int i=0;i<m;i++) {
		cin>>b[i];
		all[cnt++] = b[i];
	}
	sort(a,a+n);
	sort(b,b+m);
	sort(all,all+cnt);
	all[0] = min(a[0],b[0]) - 1;
	long long a1,b1;
	a1 = -0x3f3f3f;
	b1 = 0x3f3f3f;
	for(int i=0;i<cnt;i++) {
		int tmp = all[i];
		LL p1 = upper_bound(a,a+n,tmp) - a;
		LL p2 = upper_bound(b,b+m,tmp) - b;
		long long sum1 = 2*p1 + 3*(n-p1);
		long long sum2 = 2*p2 + 3*(m-p2);
		if(sum1-sum2 > a1-b1) {
			a1 = sum1;
			b1 = sum2;
		}
		else if(sum1 - sum2 == a1 - b1) {
			if(sum1 > a1) {
				a1 = sum1;
				b1 = sum2;
			}
		}
	}
	cout<<a1<<":"<<b1<<endl;
	return 0;
}


#include<iostream>
#include<cstdio>
#include<cstring>
#include<queue>
#include<vector>
#include<cmath>
#include<algorithm>
#include<stack>
#include<map>
#include<set>
using namespace std;

#define LL long long

const int maxn = 2*100000+20;

int a[maxn];
int b[maxn];
int all[maxn];
int n,m;
int main()
{
	cin>>n;
	int cnt = 0;
	for(int i=0;i<n;i++) {
		cin>>a[i];
		all[cnt++] = a[i];
	}
	cin>>m;
	for(int i=0;i<m;i++) {
		cin>>b[i];
		all[cnt++] = b[i];
	}
	sort(a,a+n);
	sort(b,b+m);
	sort(all,all+cnt);
	long long a1,b1;
	a1 = -0x7fffffff;
	b1 = -a1;
	for(int i=0;i<cnt;i++) {
		int tmp = all[i]-1;
		LL p1 = upper_bound(a,a+n,tmp) - a;
		LL p2 = upper_bound(b,b+m,tmp) - b;
		long long sum1 = 2*p1 + 3*(n-p1);
		long long sum2 = 2*p2 + 3*(m-p2);
		if(sum1-sum2 > a1-b1) {
			a1 = sum1;
			b1 = sum2;
		}
		else if(sum1 - sum2 == a1 - b1) {
			if(sum1 > a1) {
				a1 = sum1;
				b1 = sum2;
			}
		}
		tmp = all[i];
		p1 = upper_bound(a,a+n,tmp) - a;
		p2 = upper_bound(b,b+m,tmp) - b;
		sum1 = 2*p1 + 3*(n-p1);
		sum2 = 2*p2 + 3*(m-p2);
		if(sum1-sum2 > a1-b1) {
			a1 = sum1;
			b1 = sum2;
		}
		else if(sum1 - sum2 == a1 - b1) {
			if(sum1 > a1) {
				a1 = sum1;
				b1 = sum2;
			}
		}
	}
	cout<<a1<<":"<<b1<<endl;
	return 0;
}


#include<iostream>
#include<cstdio>
#include<cstring>
#include<queue>
#include<vector>
#include<cmath>
#include<algorithm>
#include<stack>
#include<map>
#include<set>
using namespace std;

#define LL long long

const int maxn = 2*100000+20;

int a[maxn];
int b[maxn];
int all[maxn];
int n,m;
int main()
{
	cin>>n;
	int cnt = 0;
	for(int i=0;i<n;i++) {
		cin>>a[i];
		all[cnt++] = a[i];
	}
	cin>>m;
	for(int i=0;i<m;i++) {
		cin>>b[i];
		all[cnt++] = b[i];
	}
	sort(a,a+n);
	sort(b,b+m);
	sort(all,all+cnt);
	long long a1,b1;
	a1 = -0x3f3f3f;
	b1 = 0x3f3f3f;
	for(int i=0;i<=n;i++) {
		int tmp = a[i]-1;
		if(i == n)
			tmp = 2*1000000000+1;
		LL p1 = upper_bound(a,a+n,tmp) - a;
		LL p2 = upper_bound(b,b+m,tmp) - b;
		long long sum1 = 2*p1 + 3*(n-p1);
		long long sum2 = 2*p2 + 3*(m-p2);
		if(sum1-sum2 > a1-b1) {
			a1 = sum1;
			b1 = sum2;
		}
		else if(sum1 - sum2 == a1 - b1) {
			if(sum1 > a1) {
				a1 = sum1;
				b1 = sum2;
			}
		}
	}
	cout<<a1<<":"<<b1<<endl;
	return 0;
}


#include<iostream>
#include<cstdio>
#include<cstring>
#include<queue>
#include<vector>
#include<cmath>
#include<algorithm>
#include<stack>
#include<map>
#include<set>
using namespace std;

#define LL long long

const int maxn = 2*100000+20;

int a[maxn];
int b[maxn];
int all[maxn];
int n,m;
int main()
{
	cin>>n;
	int cnt = 0;
	for(int i=0;i<n;i++) {
		cin>>a[i];
		all[cnt++] = a[i];
	}
	cin>>m;
	for(int i=0;i<m;i++) {
		cin>>b[i];
		all[cnt++] = b[i];
	}
	sort(a,a+n);
	sort(b,b+m);
	sort(all,all+cnt);
	long long a1,b1;
	a1 = -0x3f3f3f;
	b1 = 0x3f3f3f;
	for(int i=0;i<cnt;i++) {
		int tmp = all[i]-1;
		LL p1 = upper_bound(a,a+n,tmp) - a;
		LL p2 = upper_bound(b,b+m,tmp) - b;
		long long sum1 = 2*p1 + 3*(n-p1);
		long long sum2 = 2*p2 + 3*(m-p2);
		if(sum1-sum2 > a1-b1) {
			a1 = sum1;
			b1 = sum2;
		}
		else if(sum1 - sum2 == a1 - b1) {
			if(sum1 > a1) {
				a1 = sum1;
				b1 = sum2;
			}
		}
		tmp = all[i];
		p1 = upper_bound(a,a+n,tmp) - a;
		p2 = upper_bound(b,b+m,tmp) - b;
		sum1 = 2*p1 + 3*(n-p1);
		sum2 = 2*p2 + 3*(m-p2);
		if(sum1-sum2 > a1-b1) {
			a1 = sum1;
			b1 = sum2;
		}
		else if(sum1 - sum2 == a1 - b1) {
			if(sum1 > a1) {
				a1 = sum1;
				b1 = sum2;
			}
		}
	}
	cout<<a1<<":"<<b1<<endl;
	return 0;
}


#include<iostream>
#include<cstdio>
#include<cstring>
#include<queue>
#include<vector>
#include<cmath>
#include<algorithm>
#include<stack>
#include<map>
#include<set>
using namespace std;

#define LL long long

const int maxn = 2*100000+20;

int a[maxn];
int b[maxn];
int all[maxn*2];
int n,m;
int main()
{
	cin>>n;
	int cnt = 0;
	for(int i=0;i<n;i++) {
		cin>>a[i];
		all[cnt++] = a[i];
	}
	cin>>m;
	for(int i=0;i<m;i++) {
		cin>>b[i];
		all[cnt++] = b[i];
	}
	sort(a,a+n);
	sort(b,b+m);
	sort(all,all+cnt);
	long long a1,b1;
	a1 = -2*1000000000;
	b1 = -a1;
	for(int i=0;i<=cnt;i++) {
		int tmp;
                if(i == cnt)
                      tmp = 2*1000000000+1;
                else
                      tmp = all[i]-1;
		LL p1 = upper_bound(a,a+n,tmp) - a;
		LL p2 = upper_bound(b,b+m,tmp) - b;
		long long sum1 = 2*p1 + 3*(n-p1);
		long long sum2 = 2*p2 + 3*(m-p2);
		if(sum1-sum2 > a1-b1) {
			a1 = sum1;
			b1 = sum2;
		}
		else if(sum1 - sum2 == a1 - b1) {
			if(sum1 > a1) {
				a1 = sum1;
				b1 = sum2;
			}
		}

	}
	cout<<a1<<":"<<b1<<endl;
	return 0;
}


#include<iostream>
#include<cstdio>
#include<cstring>
#include<queue>
#include<vector>
#include<cmath>
#include<algorithm>
#include<stack>
#include<map>
#include<set>
using namespace std;

#define LL long long

const int maxn = 2*100000+20;

int a[maxn];
int b[maxn];
int n,m;
int main()
{
	cin>>n;
	for(int i=0;i<n;i++)
		cin>>a[i];
	cin>>m;
	for(int i=0;i<m;i++)
		cin>>b[i];
	sort(a,a+n);
	sort(b,b+m);
	int l = min(a[0],b[0]) - 1;
	int r = max(a[n-1],b[m-1]);
	long long a1,b1;
	a1 = -0x3f3f3f;
	b1 = 0x3f3f3f;
	for(int i=l;i<=r;i++) {
		LL p1 = upper_bound(a,a+n,i) - a;
		LL p2 = upper_bound(b,b+m,i) - b;
		long long sum1 = 2*p1 + 3*(n-p1);
		long long sum2 = 2*p2 + 3*(m-p2);
		if(sum1-sum2 > a1-b1) {
			a1 = sum1;
			b1 = sum2;
		}
		else if(sum1 - sum2 == a1 - b1) {
			if(sum1 > a1) {
				a1 = sum1;
				b1 = sum2;
			}
		}
	}
	cout<<a1<<":"<<b1<<endl;
	return 0;
}


#include<iostream>
#include<cstdio>
#include<cstring>
#include<queue>
#include<vector>
#include<cmath>
#include<algorithm>
#include<stack>
#include<map>
#include<set>
using namespace std;

#define LL long long

const int maxn = 2*100000+20;

int a[maxn];
int b[maxn];
int n,m;
int main()
{
	cin>>n;
	for(int i=0;i<n;i++) {
		cin>>a[i];
	}
	cin>>m;
	for(int i=0;i<m;i++) {
		cin>>b[i];
	}
	sort(a,a+n);
	sort(b,b+m);
	long long a1,b1;
	a1 = -2*1000000000;
	b1 = -a1;
	for(int i=0;i<=n;i++) {
		int tmp = a[i]-1;
		if(i == n)
			tmp = max(a[n-1],b[m-1]);
		LL p1 = upper_bound(a,a+n,tmp) - a;
		LL p2 = upper_bound(b,b+m,tmp) - b;
		long long sum1 = 2*p1 + 3*(n-p1);
		long long sum2 = 2*p2 + 3*(m-p2);
		if(sum1-sum2 > a1-b1) {
			a1 = sum1;
			b1 = sum2;
		}
		else if(sum1 - sum2 == a1 - b1) {
			if(sum1 > a1) {
				a1 = sum1;
				b1 = sum2;
			}
		}
	}
	cout<<a1<<":"<<b1<<endl;
	return 0;
}


#include<iostream>
#include<cstdio>
#include<cstring>
#include<queue>
#include<vector>
#include<cmath>
#include<algorithm>
#include<stack>
#include<map>
#include<set>
using namespace std;

#define LL long long

const int maxn = 2*100000+20;

int a[maxn];
int b[maxn];
int all[maxn];
int n,m;
int main()
{
	cin>>n;
	int cnt = 0;
	for(int i=0;i<n;i++) {
		cin>>a[i];
		all[cnt++] = a[i];
	}
	cin>>m;
	for(int i=0;i<m;i++) {
		cin>>b[i];
		all[cnt++] = b[i];
	}
	sort(a,a+n);
	sort(b,b+m);
	sort(all,all+cnt);
	long long a1,b1;
	a1 = -2*1000000000;
	b1 = -a1;
	for(int i=0;i<=cnt;i++) {
		int tmp;
                if(i == cnt)
                      tmp = 2*1000000000+1;
                else
                      tmp = all[i]-1;
		LL p1 = upper_bound(a,a+n,tmp) - a;
		LL p2 = upper_bound(b,b+m,tmp) - b;
		long long sum1 = 2*p1 + 3*(n-p1);
		long long sum2 = 2*p2 + 3*(m-p2);
		if(sum1-sum2 > a1-b1) {
			a1 = sum1;
			b1 = sum2;
		}
		else if(sum1 - sum2 == a1 - b1) {
			if(sum1 > a1) {
				a1 = sum1;
				b1 = sum2;
			}
		}

	}
	cout<<a1<<":"<<b1<<endl;
	return 0;
}


#include<iostream>
#include<cstdio>
#include<cstring>
#include<queue>
#include<vector>
#include<cmath>
#include<algorithm>
#include<stack>
#include<map>
#include<set>
using namespace std;

#define LL long long

const int maxn = 2*100000+20;

int a[maxn];
int b[maxn];
int n,m;
int main()
{
	cin>>n;
	for(int i=0;i<n;i++) {
		cin>>a[i];
	}
	cin>>m;
	for(int i=0;i<m;i++) {
		cin>>b[i];
	}
	sort(a,a+n);
	sort(b,b+m);
	long long a1,b1;
	a1 = -2*1000000000;
	b1 = -a1;
	for(int i=0;i<=n;i++) {
		int tmp = a[i]-1;
		if(i == n)
			tmp = 2*1000000000+1;
		LL p1 = upper_bound(a,a+n,tmp) - a;
		LL p2 = upper_bound(b,b+m,tmp) - b;
		long long sum1 = 2*p1 + 3*(n-p1);
		long long sum2 = 2*p2 + 3*(m-p2);
		if(sum1-sum2 > a1-b1) {
			a1 = sum1;
			b1 = sum2;
		}
		else if(sum1 - sum2 == a1 - b1) {
			if(sum1 > a1) {
				a1 = sum1;
				b1 = sum2;
			}
		}
	}
	cout<<a1<<":"<<b1<<endl;
	return 0;
}


#include<iostream>
#include<cstdio>
#include<cstring>
#include<queue>
#include<vector>
#include<cmath>
#include<algorithm>
#include<stack>
#include<map>
#include<set>
using namespace std;

#define LL long long

const int maxn = 2*100000+20;

int a[maxn];
int b[maxn];
int n,m;
int l1,r1,l2,r2;
int main()
{
	cin>>n;
	for(int i=0;i<n;i++)
		cin>>a[i];
	cin>>m;
	for(int i=0;i<m;i++)
		cin>>b[i];
	sort(a,a+n);
	sort(b,b+m);
	int l = min(a[0],b[0]) - 1;
	int r = max(a[n-1],b[m-1]);
	int a1,b1;
	a1 = -0x3f3f3f;
	b1 = 0x3f3f3f;
	for(int i=l;i<=r;i++) {
		int p1 = upper_bound(a,a+n,i) - a;
		int p2 = upper_bound(b,b+m,i) - b;
		int sum1 = 2*p1 + 3*(n-p1);
		int sum2 = 2*p2 + 3*(m-p2);
		if(sum1-sum2 > a1-b1) {
			a1 = sum1;
			b1 = sum2;
		}
		else if(sum1 - sum2 == a1 - b1) {
			if(sum1 > a1) {
				a1 = sum1;
				b1 = sum2;
			}
		}
	}
	cout<<a1<<":"<<b1<<endl;
	return 0;
}


#include<iostream>
#include<cstdio>
#include<cstring>
#include<queue>
#include<vector>
#include<cmath>
#include<algorithm>
#include<stack>
#include<map>
#include<set>
using namespace std;

#define LL long long

const int maxn = 2*100000+20;

int a[maxn];
int b[maxn];
int all[maxn];
int n,m;
int main()
{
	cin>>n;
	int cnt = 0;
	for(int i=0;i<n;i++) {
		cin>>a[i];
		all[cnt++] = a[i];
	}
	cin>>m;
	for(int i=0;i<m;i++) {
		cin>>b[i];
		all[cnt++] = b[i];
	}
	sort(a,a+n);
	sort(b,b+m);
	sort(all,all+cnt);
	long long a1,b1;
	a1 = -0x3f3f3f;
	b1 = 0x3f3f3f;
	for(int i=0;i<cnt;i++) {
		int tmp = all[i]-1;
		LL p1 = upper_bound(a,a+n,tmp) - a;
		LL p2 = upper_bound(b,b+m,tmp) - b;
		long long sum1 = 2*p1 + 3*(n-p1);
		long long sum2 = 2*p2 + 3*(m-p2);
		if(sum1-sum2 > a1-b1) {
			a1 = sum1;
			b1 = sum2;
		}
		else if(sum1 - sum2 == a1 - b1) {
			if(sum1 > a1) {
				a1 = sum1;
				b1 = sum2;
			}
		}
	}
	cout<<a1<<":"<<b1<<endl;
	return 0;
}


#include<iostream>
#include<cstdio>
#include<cstring>
#include<queue>
#include<vector>
#include<cmath>
#include<algorithm>
#include<stack>
#include<map>
#include<set>
using namespace std;

#define LL long long

const int maxn = 2*100000+20;

int a[maxn];
int b[maxn];
LL n,m;
int main()
{
	cin>>n;
	for(int i=0;i<n;i++) {
		cin>>a[i];
	}
	cin>>m;
	for(int i=0;i<m;i++) {
		cin>>b[i];
	}
	sort(a,a+n);
	sort(b,b+m);
	long long a1,b1;
	a1 = -2*1000000000;
	b1 = -a1;
	for(int i=0;i<=n;i++) {
		int tmp = a[i]-1;
		if(i == n)
			tmp = 2*1000000000+1;
		LL p1 = upper_bound(a,a+n,tmp) - a;
		LL p2 = upper_bound(b,b+m,tmp) - b;
		long long sum1 = 2*p1 + 3*(n-p1);
		long long sum2 = 2*p2 + 3*(m-p2);
		if(sum1-sum2 > a1-b1) {
			a1 = sum1;
			b1 = sum2;
		}
		else if(sum1 - sum2 == a1 - b1) {
			if(sum1 > a1) {
				a1 = sum1;
				b1 = sum2;
			}
		}
	}
	cout<<a1<<":"<<b1<<endl;
	return 0;
}


#include <iostream>
#include <algorithm>

using namespace std;

int main()
{
	long long int n, m, i, j, scoreA, scoreB, thisA, thisB, l, r, mid;

	cin>>n;
	long long int a[n];
	for(i=0;i<n;i++)
		cin>>a[i];

	cin>>m;
	long long int b[m];
	for(i=0;i<m;i++)
		cin>>b[i];

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

	scoreA = n*3;
	scoreB = m*3;

	l = min(a[0], b[0])-1;
	r = max(a[n-1], b[m-1])+1;
	while(l<=r)
	{
		mid = (l+r)/2;
		//cout<<mid<<endl;
		long long int *la = upper_bound(a, a+n ,mid);
		i = la - a;
		long long int *lb = upper_bound(b, b+n ,mid);
		j = lb - b;

		//cout<<i<<" "<<j<<endl;
		if(i>=0 && i<=n && j>=0 && j<=m)
		{
			thisA = 2*i + 3*(n-i);
			thisB = 2*j + 3*(m-j);

			if((thisA-thisB)>(scoreA-scoreB) || ((thisA-thisB)>(scoreA-scoreB)&&(thisA>scoreA)))
			{
				scoreA = thisA;
				scoreB = thisB;
				l = mid+1;
			}
			else
			{
				r = mid-1;
			}
		}
		else
			break;

	}

	cout<<scoreA<<":"<<scoreB<<endl;

	return 0;
}


#include <iostream>
#include <algorithm>

using namespace std;

int main()
{
	long long int n, m, i, j, scoreA, scoreB, thisA, thisB;

	cin>>n;
	long long int a[n];
	for(i=0;i<n;i++)
		cin>>a[i];

	cin>>m;
	long long int b[m];
	for(i=0;i<m;i++)
		cin>>b[i];

	scoreA = n*3;
	scoreB = m*3;

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

	i = 0, j = 0;
	while(i<n && j<m)
	{
		if(a[i]<b[j])
			i++;
		else if(a[i]>b[j])
			j++;
		else
			i++, j++;

		thisA = 2*i + 3*(n-i);
		thisB = 2*j + 3*(m-j);
		if((thisA-thisB)>(scoreA-scoreB) || ((thisA-thisB)==(scoreA-scoreB)&&(thisA>scoreA)))
		{
			scoreA = thisA;
			scoreB = thisB;
		}
	}

	while(i<n)
	{
		i++;
		thisA = 2*i + 3*(n-i);
		thisB = 2*j + 3*(m-j);
		if((thisA-thisB)>(scoreA-scoreB) || ((thisA-thisB)==(scoreA-scoreB)&&(thisA>scoreA)))
		{
			scoreA = thisA;
			scoreB = thisB;
		}
	}

	while(j<m)
	{
		j++;
		thisA = 2*i + 3*(n-i);
		thisB = 2*j + 3*(m-j);
		if((thisA-thisB)>(scoreA-scoreB) || ((thisA-thisB)>(scoreA-scoreB)&&(thisA>scoreA)))
		{
			scoreA = thisA;
			scoreB = thisB;
		}
	}

	cout<<scoreA<<":"<<scoreB<<endl;

	return 0;
}


#include <iostream>
#include <algorithm>

using namespace std;

int main()
{
	long long int n, m, i, j, scoreA, scoreB, thisA, thisB, l, r, mid;

	cin>>n;
	long long int a[n];
	for(i=0;i<n;i++)
		cin>>a[i];

	cin>>m;
	long long int b[m];
	for(i=0;i<m;i++)
		cin>>b[i];

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

	scoreA = n*3;
	scoreB = m*3;

	l = min(a[0], b[0])-1;
	r = max(a[n-1], b[m-1])+1;
	while(l<=r)
	{
		mid = (l+r)/2;
		long long int *la = lower_bound(a, a+n ,mid);
		i = la - a ;
		long long int *lb = lower_bound(b, b+n ,mid);
		j = lb - b ;

		thisA = 2*i + 3*(n-i);
		thisB = 2*j + 3*(m-j);

		if((thisA-thisB)>(scoreA-scoreB) || ((thisA-thisB)>(scoreA-scoreB)&&(thisA>scoreA)))
		{
			scoreA = thisA;
			scoreB = thisB;
			l = mid+1;
		}
		else
		{
			r = mid-1;
		}
	}

	cout<<scoreA<<":"<<scoreB<<endl;

	return 0;
}


#include <iostream>
#include <algorithm>

using namespace std;

int main()
{
	long long int n, m, i, j, scoreA, scoreB, thisA, thisB, l, r, mid;

	cin>>n;
	long long int a[n];
	for(i=0;i<n;i++)
		cin>>a[i];

	cin>>m;
	long long int b[m];
	for(i=0;i<m;i++)
		cin>>b[i];

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

	scoreA = n*3;
	scoreB = m*3;

	thisA = n*2;
	thisB = m*2;
	if((thisA-thisB)>(scoreA-scoreB) || ((thisA-thisB)==(scoreA-scoreB)&&(thisA>scoreA)))
	{
		scoreA = thisA;
		scoreB = thisB;
	}

	l = min(a[0], b[0])-1;
	r = max(a[n-1], b[m-1])+1;
	while(l<=r)
	{
		mid = (l+r)/2;
		//cout<<mid<<endl;
		long long int *la = upper_bound(a, a+n ,mid);
		i = la - a;
		long long int *lb = upper_bound(b, b+n ,mid);
		j = lb - b;

		//cout<<i<<" "<<j<<endl;
		if(i>=0 && i<=n && j>=0 && j<=m)
		{
			thisA = 2*i + 3*(n-i);
			thisB = 2*j + 3*(m-j);

			if((thisA-thisB)>(scoreA-scoreB) || ((thisA-thisB)==(scoreA-scoreB)&&(thisA>scoreA)))
			{
				scoreA = thisA;
				scoreB = thisB;
				l = mid+1;
			}
			else
			{
				r = mid-1;
			}
		}
		else
			break;

	}

	cout<<scoreA<<":"<<scoreB<<endl;

	return 0;
}


#include <iostream>
#include <algorithm>

using namespace std;

int main()
{
	long long int n, m, i, j, scoreA, scoreB, thisA, thisB;

	cin>>n;
	long long int a[n];
	for(i=0;i<n;i++)
		cin>>a[i];

	cin>>m;
	long long int b[m];
	for(i=0;i<m;i++)
		cin>>b[i];

	scoreA = n*3;
	scoreB = m*3;

	i = 0, j = 0;
	while(i<n && j<m)
	{
		if(a[i]<b[j])
			i++;
		else if(a[i]>b[j])
			j++;
		else
			i++, j++;

		thisA = 2*i + 3*(n-i);
		thisB = 2*j + 3*(n-j);
		if((thisA-thisB)>(scoreA-scoreB) || ((thisA-thisB)>(scoreA-scoreB)&&(thisA>scoreA)))
		{
			scoreA = thisA;
			scoreB = thisB;
		}
	}

	cout<<scoreA<<":"<<scoreB<<endl;

	return 0;
}


#include <iostream>
#include <algorithm>

using namespace std;

int main()
{
	long long int n, m, i, j, scoreA, scoreB, thisA, thisB;

	cin>>n;
	long long int a[n];
	for(i=0;i<n;i++)
		cin>>a[i];

	cin>>m;
	long long int b[m];
	for(i=0;i<m;i++)
		cin>>b[i];

	scoreA = n*3;
	scoreB = m*3;

	i = 0, j = 0;
	while(i<n && j<m)
	{
		if(a[i]<b[j])
			i++;
		else if(a[i]>b[j])
			j++;
		else
			i++, j++;

		thisA = 2*i + 3*(n-i);
		thisB = 2*j + 3*(m-j);
		if((thisA-thisB)>(scoreA-scoreB) || ((thisA-thisB)>(scoreA-scoreB)&&(thisA>scoreA)))
		{
			scoreA = thisA;
			scoreB = thisB;
		}
	}

	while(i<n)
	{
		i++;
		thisA = 2*i + 3*(n-i);
		thisB = 2*j + 3*(m-j);
		if((thisA-thisB)>(scoreA-scoreB) || ((thisA-thisB)>(scoreA-scoreB)&&(thisA>scoreA)))
		{
			scoreA = thisA;
			scoreB = thisB;
		}
	}

	while(j<m)
	{
		j++;
		thisA = 2*i + 3*(n-i);
		thisB = 2*j + 3*(m-j);
		if((thisA-thisB)>(scoreA-scoreB) || ((thisA-thisB)>(scoreA-scoreB)&&(thisA>scoreA)))
		{
			scoreA = thisA;
			scoreB = thisB;
		}
	}

	cout<<scoreA<<":"<<scoreB<<endl;

	return 0;
}


#include <iostream>
#include <algorithm>

using namespace std;

int main()
{
	long long int n, m, i, j, scoreA, scoreB, thisA, thisB, l, r, mid;

	cin>>n;
	long long int a[n];
	for(i=0;i<n;i++)
		cin>>a[i];

	cin>>m;
	long long int b[m];
	for(i=0;i<m;i++)
		cin>>b[i];

	scoreA = n*3;
	scoreB = m*3;

	l = min(a[0], b[0])-1;
	r = max(a[n-1], b[m-1])+1;
	while(l<=r)
	{
		mid = (l+r)/2;
		long long int *la = lower_bound(a, a+n ,mid);
		i = a - la + 1;
		long long int *lb = lower_bound(b, b+n ,mid);
		j = b - lb + 1;

		thisA = 2*i + 3*(n-i);
		thisB = 2*j + 3*(m-j);

		if((thisA-thisB)>(scoreA-scoreB) || ((thisA-thisB)>(scoreA-scoreB)&&(thisA>scoreA)))
		{
			scoreA = thisA;
			scoreB = thisB;
			l = mid+1;
		}
		else
		{
			r = mid-1;
		}
	}

	cout<<scoreA<<":"<<scoreB<<endl;

	return 0;
}


#include <iostream>
#include <algorithm>

using namespace std;

int main()
{
	long long int n, m, i, j, scoreA, scoreB, thisA, thisB;

	cin>>n;
	long long int a[n];
	for(i=0;i<n;i++)
		cin>>a[i];

	cin>>m;
	long long int b[m];
	for(i=0;i<m;i++)
		cin>>b[i];

	scoreA = n*3;
	scoreB = m*3;

	i = 0, j = 0;
	while(i<n && j<m)
	{
		if(a[i]<b[j])
			i++;
		else if(a[i]>b[j])
			j++;
		else
			i++, j++;

		thisA = 2*i + 3*(n-i);
		thisB = 2*j + 3*(m-j);
		if((thisA-thisB)>(scoreA-scoreB) || ((thisA-thisB)>(scoreA-scoreB)&&(thisA>scoreA)))
		{
			scoreA = thisA;
			scoreB = thisB;
		}
	}

	cout<<scoreA<<":"<<scoreB<<endl;

	return 0;
}


#include <iostream>
#include <algorithm>

using namespace std;

int main()
{
	long long int n, m, i, j, scoreA, scoreB, thisA, thisB, l, r, mid;

	cin>>n;
	long long int a[n];
	for(i=0;i<n;i++)
		cin>>a[i];

	cin>>m;
	long long int b[m];
	for(i=0;i<m;i++)
		cin>>b[i];

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

	scoreA = n*3;
	scoreB = m*3;

	thisA = n*2;
	thisB = m*2;
	if((thisA-thisB)>(scoreA-scoreB) || ((thisA-thisB)>(scoreA-scoreB)&&(thisA>scoreA)))
	{
		scoreA = thisA;
		scoreB = thisB;
	}

	l = min(a[0], b[0])-1;
	r = max(a[n-1], b[m-1])+1;
	while(l<=r)
	{
		mid = (l+r)/2;
		//cout<<mid<<endl;
		long long int *la = upper_bound(a, a+n ,mid);
		i = la - a;
		long long int *lb = upper_bound(b, b+n ,mid);
		j = lb - b;

		//cout<<i<<" "<<j<<endl;
		if(i>=0 && i<=n && j>=0 && j<=m)
		{
			thisA = 2*i + 3*(n-i);
			thisB = 2*j + 3*(m-j);

			if((thisA-thisB)>(scoreA-scoreB) || ((thisA-thisB)>(scoreA-scoreB)&&(thisA>scoreA)))
			{
				scoreA = thisA;
				scoreB = thisB;
				l = mid+1;
			}
			else
			{
				r = mid-1;
			}
		}
		else
			break;

	}

	cout<<scoreA<<":"<<scoreB<<endl;

	return 0;
}


#include <iostream>
#include <algorithm>

using namespace std;

int main()
{
	long long int n, m, i, j, scoreA, scoreB, thisA, thisB;

	cin>>n;
	long long int a[n];
	for(i=0;i<n;i++)
		cin>>a[i];

	cin>>m;
	long long int b[m];
	for(i=0;i<m;i++)
		cin>>b[i];

	scoreA = n*3;
	scoreB = m*3;

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

	i = 0, j = 0;
	while(i<n && j<m)
	{
		if(a[i]<b[j])
			i++;
		else if(a[i]>b[j])
			j++;
		else
			i++, j++;

		thisA = 2*i + 3*(n-i);
		thisB = 2*j + 3*(m-j);
		if((thisA-thisB)>(scoreA-scoreB) || ((thisA-thisB)>(scoreA-scoreB)&&(thisA>scoreA)))
		{
			scoreA = thisA;
			scoreB = thisB;
		}
	}

	while(i<n)
	{
		i++;
		thisA = 2*i + 3*(n-i);
		thisB = 2*j + 3*(m-j);
		if((thisA-thisB)>(scoreA-scoreB) || ((thisA-thisB)>(scoreA-scoreB)&&(thisA>scoreA)))
		{
			scoreA = thisA;
			scoreB = thisB;
		}
	}

	while(j<m)
	{
		j++;
		thisA = 2*i + 3*(n-i);
		thisB = 2*j + 3*(m-j);
		if((thisA-thisB)>(scoreA-scoreB) || ((thisA-thisB)>(scoreA-scoreB)&&(thisA>scoreA)))
		{
			scoreA = thisA;
			scoreB = thisB;
		}
	}

	cout<<scoreA<<":"<<scoreB<<endl;

	return 0;
}


#include <cstdio>
#include <algorithm>
using namespace std;
#define LL long long
const int maxn=2000005;
int n,m;
LL a[maxn],b[maxn], c[maxn];
int main()
{
    //freopen ("in.txt","r",stdin);
    int k,i,j,sk,sj,maxx=-4000010,cur,an=0,bn=0,cnt=0;
    LL ans1,ans2;
    scanf("%ld",&n);
    for(i=0;i<n;i++)
    {
        scanf("%lld",&a[i]);
        c[cnt++]=a[i];
    }
    sort(a,a+n);
    scanf("%ld",&m);
    for(i=0;i<m;i++)
    {
        scanf("%lld",&b[i]);
        c[cnt++]=b[i];
    }
    sort(b,b+m);
    sort(c,c+cnt);
    cnt=unique(c,c+cnt)-c;
    c[cnt]=c[cnt-1]+1;
    cnt++;
    sk=0,sj=0;
    for(i=0;i<cnt;i++)
    {
        if(a[n-1]<c[i])
            k=n;
        else
        for(k=sk;k<n;k++)
            if(a[k]>=c[i])
            {
                sk=k;
                break;
            }
        if(b[m-1]<c[i])
            j=m;
        else
        for(j=sj;j<m;j++)
            if(b[j]>=c[i])
            {
                sj=j;
                break;
            }
		cur=j-k;
        if(maxx<cur||(maxx==cur&&(m-j)>(n-k)))
        {
            maxx=cur;
            an=k;
            bn=j;
        }
    }
    ans1=2*an+3*(n-an);
    ans2=2*bn+3*(m-bn);
    printf("%lld:%lld\n", ans1,ans2);
    return 0;
}


#include <cstdio>
#include <algorithm>
using namespace std;
const int maxn=1000005;
int n,m;
int a[maxn],b[maxn];
int c[maxn];
int main()
{
   // freopen ("in.txt","r",stdin);
    int k,i,j,ans1,ans2,max=-1000000,cur,an=0,bn=0,cnt=0;
    scanf("%d",&n);
    for(i=0;i<n;i++)
    {
        scanf("%d",&a[i]);
        c[cnt++]=a[i];
    }
    sort(a,a+n);
    scanf("%d",&m);
    for(i=0;i<m;i++)
    {
        scanf("%d",&b[i]);
        c[cnt++]=b[i];
    }
    sort(b,b+m);
    sort(c,c+cnt);
    cnt=unique(c,c+cnt)-c;
	c[cnt]=c[cnt-1]+1;
    for(i=0;i<=cnt;i++)
    {
        for(k=0;k<n;i++)
            if(a[k]>=c[i])break;
        for(j=0;j<m;j++)
            if(b[j]>=c[i])break;
		cur=j-k;
        if(max<cur)
        {
            max=cur;
            an=k;
            bn=j;
        }
    }
    ans1=2*an+3*(n-an);
    ans2=2*bn+3*(m-bn);
    printf("%d:%d\n", ans1,ans2);
    return 0;
}


            ans2=sum2;
#include <cstdio>
#include <algorithm>
using namespace std;
const int maxn=200005;
int num1,num2,n,m;
int a[maxn],b[maxn],c[maxn];
void A(int x)
{
    for(int i=0;i<n;i++)
        if(a[i]<c[x])
            num1++;
	for(int j=0;j<m;j++)
		if(b[j]<c[x])
			num2++;
}
int main()
{
    //freopen ("in.txt","r",stdin);
    int i,ans1,ans2,sum1,sum2,max=0,cur=0,cnt=0;
    scanf("%d",&n);
    for(i=0;i<n;i++)
	{
        scanf("%d",&a[i]);
		c[cnt++]=a[i];
	}
    scanf("%d",&m);
    for(i=0;i<m;i++)
	{
        scanf("%d",&b[i]);
		c[cnt++]=b[i];
	}
    sort(c,c+cnt);
	cnt=unique(c,cnt+c)-c;
	c[cnt]=c[cnt-1]+1;
    for(i=0;i<=cnt;i++)
    {
        num1=0,num2=0;
        A(i);
        sum1=2*num1+3*(n-num1);
        sum2=2*num2+3*(m-num2);
        //if(sum1>=sum2)
            cur=sum1-sum2;
		//else
		//	cur=sum2-sum1;
        if(max<cur||(max==cur&&ans1<sum1))
        {
            ans1=sum1;
            ans2=sum2;
            max=cur;
        }
    }
    printf("%d:%d\n", ans1,ans2);
    return 0;
}


#include<stdio.h>
#include<algorithm>
#include<iostream>
#include<string.h>
using namespace std;
const int maxn = 200005;
int a[maxn], b[maxn], nul[2 * maxn];
int main()
{
	int n, m;
	scanf("%d", &n);
	int i, j;
	for(i = 1; i <= n; i++)
		scanf("%d", &a[i]);
	scanf("%d", &m);
	for(i = 1; i <= m; i++)
		scanf("%d", &b[i]);
	sort(a + 1, a + n + 1);
	sort(b + 1, b + m + 1);
	for(i = 1; i <= n; i++)
		nul[i] = a[i];
	for(i = n + 1; i <= n + m; i++)
		nul[i] = b[i - n];
	sort(nul + 1, nul + n + m +1);
	int A, B;
	nul[0] = 0;
	nul[n + m + 1] = nul[n + m] + 1;
	int maxx = -1000000;
	for(i = 0; i <= n + m + 1 ; i++)
	{
		int cnt1 = 0, cnt2 = 0, sum = 0;
		for(j = 1; j <=n; j++)
			if(a[j] > nul[i]) cnt1++;
		for(j = 1; j <= m; j++)
			if(b[j] > nul[i]) cnt2++;
		sum = 3 * cnt1 + 2 * (n - cnt1) - (3 * cnt2 + 2 * (m - cnt2));
		if(sum > maxx)
		{
			maxx = sum;
			A = 3 * cnt1 + 2 * (n - cnt1);
			B = 3 * cnt2 + 2 * (m - cnt2);
		}
	}
	printf("%d:%d\n", A, B);
	return 0;
}


#include<stdio.h>
#include <iostream>
#include <algorithm>
using namespace std;
int a[333333],b[333333],all[333333*2];
int num(int d,int n,int a[])
 {
     int low=0,high=n-1,mid=n/2;
     while(low<=high)
     {
         if(a[mid]==d)
         {
             while(a[mid]==d){
                mid++;
             }
             return n-mid;
         }
         if(a[mid]>d)
             high=mid-1;
         if(a[mid]<d)
             low=mid+1;
         mid=(high+low)/2;
     }
     return n-high-1;
 }
int main(){

int n,m,i,t=1,cont1,cont2,C=-10000000,sum,score1,score2,A,B;

while((scanf("%d",&n))!=EOF){
   for(i=0;i<n;i++){
    scanf("%d",&a[i]);
    all[t++]=a[i];
   }
   scanf("%d",&m);
   for(i=0;i<m;i++){
    scanf("%d",&b[i]);
    all[t++]=b[i];
   }
   A=3*n;
   B=3*m;
    all[0]=0;
   sort(a,a+n);
     sort(b,b+m);
     sort(all,all+(m+n+1));
   all[m+n+1]=a[m+n]+1;
   for(i=0;i<m+n+2;i++){
        if(i>0&&all[i]==all[i-1])
            continue;

    cont1=num(all[i],n,a);
    cont2=num(all[i],m,b);
     score1=2*(n-cont1)+3*cont1;
     score2=2*(m-cont2)+3*cont2;
    sum=score1-score2;
    if(sum>C){
        C=sum;
        A=score1;
        B=score2;
    }

   }
   printf("%d:%d\n",A,B);
}
return 0;
}


#include <iostream>
 #include <stdio.h>
 #include <algorithm>
 using namespace std;
 int one[200005],two[200005],all[400005];
 int num(int d,int n,int a[])
 {
     int low=0,high=n-1,mid=n/2;
     while(low<=high)
     {
         if(a[mid]==d)
         {
             while(a[mid]==d){
                mid++;
             }
             return n-mid;
         }
         if(a[mid]>d)
             high=mid-1;
         if(a[mid]<d)
             low=mid+1;
         mid=(high+low)/2;
     }
     return n-high-1;
 }
 int main()
 {
     int i,t=1,C=-1000000,n,m;
     cin>>n;
     for(i=0;i<n;i++)
     {
         scanf("%d",&one[i]);
         all[t++]=one[i];
     }

    cin>>m;
     for(i=0;i<m;i++)
     {
         scanf("%d",&two[i]);
         all[t++]=two[i];
     }

    all[0]=0;
     sort(one,one+n);
     sort(two,two+m);
     sort(all,all+(m+n+1));
     all[m+n+1]=all[m+n]+1;
     int cont1,cont2,A,B,sum;
     for(i=0;i<m+n+2;i++)
     {
         if(i>0&&all[i]==all[i-1])
             continue;
        cont1=num(all[i],n,one);
         cont2=num(all[i],m,two);
         sum=(tmp1*3+(n-tmp1)*2)-(tmp2*3+(m-tmp2)*2);
         if(sum>C)
         {
             C=sum;
             A=tmp1*3+(n-tmp1)*2;
            B=tmp2*3+(m-tmp2)*2;
         }
     }
     cout<<A<<":"<<B<<endl;
     return 0;
 }


#include <cstdio>
#include <algorithm>
using namespace std;
#define LL long long
const int maxn=2000005;
int n,m;
LL a[maxn],b[maxn], c[maxn];
int main()
{
    //freopen ("in.txt","r",stdin);
    int k,i,j,sk,sj,maxx=-4000010,cur,an=0,bn=0,cnt=0;
    LL ans1,ans2;
    scanf("%d",&n);
    for(i=0;i<n;i++)
    {
        scanf("%lld",&a[i]);
        c[cnt++]=a[i];
    }
    sort(a,a+n);
    scanf("%d",&m);
    for(i=0;i<m;i++)
    {
        scanf("%lld",&b[i]);
        c[cnt++]=b[i];
    }
    sort(b,b+m);
    sort(c,c+cnt);
    cnt=unique(c,c+cnt)-c;
    sk=0,sj=0;
    for(i=0;i<cnt;i++)
    {
        if(a[n-1]<c[i])
            k=n;
        else
        for(k=sk;k<n;k++)
            if(a[k]>=c[i])
            {
                sk=k;
                break;
            }
        if(b[m-1]<c[i])
            j=m;
        else
        for(j=0;j<m;j++)
            if(b[j]>=c[i])
            {
                sj=j;
                break;
            }
		cur=j-k;
        if(maxx<cur)
        {
            maxx=cur;
            an=k;
            bn=j;
        }
    }
    ans1=2*an+3*(n-an);
    ans2=2*bn+3*(m-bn);
    printf("%lld:%lld\n", ans1,ans2);
    return 0;
}


#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
const int maxn=200005;
int num1,num2,n,m;
int a[maxn],b[maxn],c[maxn];
int an[maxn],bn[maxn];
int main()
{
    //freopen ("in.txt","r",stdin);
    int i,j,ans1,ans2,tn,max=-100000,cur,cnt=0;
    scanf("%d",&n);
    for(i=0;i<n;i++)
	{
        scanf("%d",&a[i]);
		c[cnt++]=a[i];
	}
	sort(a,a+n);
    scanf("%d",&m);
    for(i=0;i<m;i++)
	{
        scanf("%d",&b[i]);
		c[cnt++]=b[i];
	}
	sort(b,b+m);
    sort(c,c+cnt);
	cnt=unique(c,cnt+c)-c;
	for(i=0;i<cnt;i++)
	{
		for(j=0;j<n;j++)
			if(a[j]<c[i])
				an[c[i]]++;
		for(j=0;j<m;j++)
			if(b[j]<c[i])
				bn[c[i]]++;
	}
    for(i=0;i<cnt;i++)
    {
        num1=an[c[i]],num2=bn[c[i]];
        cur=num2-num1;
        if(max<cur||(max==cur&&num1<tn))
        {
            ans1=2*num1+3*(n-num1);
            ans2=2*num2+3*(m-num2);
            max=cur;
			tn=num1;
        }
    }
    printf("%d:%d\n", ans1,ans2);
    return 0;
}


#include<stdio.h>
#include <iostream>
#include <algorithm>
using namespace std;
int a[200005],b[200005],all[400005];
int num(int d,int n,int a[])
{
	int low=0,high=n-1,mid=n/2;
 	while(low<=high)
  	{
   		if(a[mid]==d)
     	{
      		while(a[mid]==d)
			{
				mid++;
    		}
      		return n-mid;
  		}
    	if(a[mid]>d)
     		high=mid-1;
       	if(a[mid]<d)
        	low=mid+1;
       	mid=(high+low)/2;
	}
 	return n-high-1;
}
int main()
{
	int n,m,i,t=1,cont1,cont2,C=-1000000,sum,score1,score2;
	int A, B;
		scanf("%d", &n);
		for(i=0;i<n;i++)
		{
		    scanf("%d",&a[i]);
		    all[t++]=a[i];
		}
		scanf("%d",&m);
		for(i=0;i<m;i++)
		{
			scanf("%d",&b[i]);
			all[t++]=b[i];
		}
		all[0]=0;
		sort(a,a+n);
		sort(b,b+m);
	 	sort(all,all+(m+n+1));
	   	all[m+n+1]=a[m+n]+1;
	   	for(i=0;i<m+n+2;i++)
	   	{
	    	if(i>0&&all[i]==all[i-1])
	     		continue;
	    	cont1=num(all[i],n,a);
	    	cont2=num(all[i],m,b);
	     	score1=2*(n-cont1)+3*cont1;
	     	score2=2*(m-cont2)+3*cont2;
	    	sum=score1-score2;
	    	if(sum>C)
			{
		        C=sum;
		        A=score1;
		        B=score2;
	    	}
		}
   		printf("%d:%d\n",A,B);
	return 0;
}


#include <cstdio>
#include <algorithm>
using namespace std;
#define LL long long
const int maxn=2000005;
int n,m;
LL a[maxn],b[maxn], c[maxn];
int main()
{
   // freopen ("in.txt","r",stdin);
    int k,i,j,sk,sj,max=-4000010,cur,an=0,bn=0,cnt=0;
    LL ans1,ans2;
    scanf("%d",&n);
    for(i=0;i<n;i++)
    {
        scanf("%lld",&a[i]);
        c[cnt++]=a[i];
    }
    sort(a,a+n);
    scanf("%d",&m);
    for(i=0;i<m;i++)
    {
        scanf("%lld",&b[i]);
        c[cnt++]=b[i];
    }
    sort(b,b+m);
    sort(c,c+cnt);
    cnt=unique(c,c+cnt)-c;
    sk=0,sj=0;
    for(i=0;i<cnt;i++)
    {
        if(a[n-1]<c[i])
            k=n;
        else
        for(k=sk;k<n;k++)
            if(a[k]>=c[i])
            {
                sk=k;
                break;
            }
        if(b[m-1]<c[i])
            j=m;
        else
        for(j=0;j<m;j++)
            if(b[j]>=c[i])
            {
                sj=j;
                break;
            }
		cur=j-k;
        if(max<cur)
        {
            max=cur;
            an=k;
            bn=j;
        }
    }
    ans1=2*an+3*(n-an);
    ans2=2*bn+3*(m-bn);
    printf("%lld:%lld\n", ans1,ans2);
    return 0;
}


#include<stdio.h>
#include <iostream>
#include <algorithm>
using namespace std;
int a[333333],b[333333],all[333333*2];
int num(int d,int n,int a[])
{
	int low=0,high=n-1,mid=n/2;
 	while(low<=high)
  	{
   		if(a[mid]==d)
     	{
      		while(a[mid]==d)
			{
				mid++;
    		}
      		return n-mid;
  		}
    	if(a[mid]>d)
     		high=mid-1;
       	if(a[mid]<d)
        	low=mid+1;
       	mid=(high+low)/2;
	}
 	return n-high-1;
}
int main()
{
	int n,m,i,t=1,cont1,cont2,C=-10000000,sum,score1,score2;
	int A, B;
		scanf("%d", &n);
		for(i=0;i<n;i++)
		{
		    scanf("%d",&a[i]);
		    all[t++]=a[i];
		}
		scanf("%d",&m);
		for(i=0;i<m;i++)
		{
			scanf("%d",&b[i]);
			all[t++]=b[i];
		}
		all[0]=0;
		sort(a,a+n);
		sort(b,b+m);
	 	sort(all,all+(m+n+1));
	   	all[m+n+1]=a[m+n]+1;
	   	for(i=0;i<m+n+2;i++)
	   	{
	    	if(i>0&&all[i]==all[i-1])
	     		continue;
	    	cont1=num(all[i],n,a);
	    	cont2=num(all[i],m,b);
	     	score1=2*(n-cont1)+3*cont1;
	     	score2=2*(m-cont2)+3*cont2;
	    	sum=score1-score2;
	    	if(sum>C)
			{
		        C=sum;
		        A=score1;
		        B=score2;
	    	}
		}
   		printf("%d:%d\n",A,B);
	return 0;
}


#include <iostream>
#include <algorithm>
#define ll long long
using namespace std;
int const MAX = 200005;
ll a[MAX], b[MAX], n, m;

int main()
{
    cin >> n;
    for(int i = 0; i < n; i++)
        cin >> a[i];
    cin >> m;
    for(int i = 0; i < m; i++)
        cin >> b[i];
    sort(a, a + n);
    sort(b, b + m);
    int j = m - 1;
    ll x = 0, y = 0, ab = n, ba = m;
    for(int i = n - 1; i >= 0; i--)
    {
        while(j >= 0 && a[i] <= b[j])
        {
            j--;
            y++;
        }
        x++;
        if(x - y >= ab - ba)
        {
            ab = x;
            ba = y;
        }
    }
    if(ab < ba)
        ab = ba = 0;
    cout << n * 2 + ab << ":" << m * 2 + ba << endl;
}


#include<stdio.h>
#include <iostream>
#include <algorithm>
using namespace std;
int a[333333],b[333333],all[333333*2];
int num(int d,int n,int a[])
 {
     int low=0,high=n-1,mid=n/2;
     while(low<=high)
     {
         if(a[mid]==d)
         {
             while(a[mid]==d){
                mid++;
             }
             return n-mid;
         }
         if(a[mid]>d)
             high=mid-1;
         if(a[mid]<d)
             low=mid+1;
         mid=(high+low)/2;
     }
     return n-high-1;
 }
int main(){

int n,m,i,d,t=1,cont1,cont2,C=-10000000,sum,score1,score2,A,B;
all[0]=0;
while((scanf("%d",&n))!=EOF){
   for(i=0;i<n;i++){
    scanf("%d",&a[i]);
    all[t++]=a[i];
   }
   scanf("%d",&m);
   for(i=0;i<m;i++){
    scanf("%d",&b[i]);
    all[t++]=b[i];
   }
   sort(a,a+n);
     sort(b,b+m);
     sort(all,all+(m+n+1));
   all[m+n+1]=a[m+n]+1;
   for(i=0;i<m+n+2;i++){
        if(i>0&&all[i]==all[i-1])
            continue;

    cont1=num(all[i],n,a);
    cont2=num(all[i],m,b);
     score1=2*(n-cont1)+3*cont1;
     score2=2*(m-cont2)+3*cont2;
    sum=score1-score2;
    if(sum>C||(sum==C&&score1>A)){
        C=sum;
        A=score1;
        B=score2;
    }

   }
   printf("%d:%d\n",A,B);
}
return 0;
}


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

#define N 200005
#define M 105
#define mod 1000000007
//#define p 10000007
#define mod2 1000000000
#define ll long long
#define LL long long
#define eps 1e-6
#define inf 100000000
#define maxi(a,b) (a)>(b)? (a) : (b)
#define mini(a,b) (a)<(b)? (a) : (b)

using namespace std;

int n,m;
int a[N];
int b[N];
int cou;
int ma;
int c1;
int c2;
int cc1,cc2;
int ans1,ans2;

void ini()
{
    int i;
    for(i=1;i<=n;i++){
        scanf("%d",&a[i]);
    }
    scanf("%d",&m);
    for(i=1;i<=m;i++){
        scanf("%d",&b[i]);
    }
    sort(a+1,a+1+n);
    sort(b+1,b+1+m);
    cou=0;
    c1=c2=0;
    ma=0;
}

void solve()
{
    int i=n;
    int j=m;
    while(i>=1 || j>=1){
        if(i==0) break;
        if(j==0){
            c1++;cou++;i--;
            if(ma<cou){
                ma=cou;
                cc1=c1;
                cc2=c2;
            }
            continue;
        }
        if(a[i]==b[j]){
            c1++;c2++;i--;j--;
            continue;
        }
        else if(a[i]>b[j]){
            c1++;i--;cou++;
            if(ma<cou){
                ma=cou;
                cc1=c1;
                cc2=c2;
            }
            continue;
        }
        else{
            c2++;cou--;j--;
        }
    }
    ans1=3*cc1+2*(n-cc1);
    ans2=3*cc2+2*(m-cc2);
}

void out()
{
    printf("%d:%d\n",ans1,ans2);
}

int main()
{
    //freopen("data.in","r",stdin);
    //freopen("data.out","w",stdout);
    //scanf("%d",&T);
    //for(int ccnt=1;ccnt<=T;ccnt++)
    //while(T--)
    //scanf("%d%d",&n,&m);
    while(scanf("%d",&n)!=EOF)
    {
        ini();
        solve();
        out();
    }
    return 0;
}


#include<stdio.h>
#include <iostream>
#include <algorithm>
using namespace std;
int a[333333],b[333333],all[333333*2];
int num(int d,int n,int a[])
 {
     int low=0,high=n-1,mid=n/2;
     while(low<=high)
     {
         if(a[mid]==d)
         {
             while(a[mid]==d){
                mid++;
             }
             return n-mid;
         }
         if(a[mid]>d)
             high=mid-1;
         if(a[mid]<d)
             low=mid+1;
         mid=(high+low)/2;
     }
     return n-high-1;
 }
int main(){

int n,m,i,d,t=1,cont1,cont2,C=-10000000,sum,score1=3*n,score2=3*m,A,B;
all[0]=0;
while((scanf("%d",&n))!=EOF){
   for(i=0;i<n;i++){
    scanf("%d",&a[i]);
    all[t++]=a[i];
   }
   scanf("%d",&m);
   for(i=0;i<m;i++){
    scanf("%d",&b[i]);
    all[t++]=b[i];
   }
   sort(a,a+n);
     sort(b,b+m);
     sort(all,all+(m+n+1));
   all[m+n+1]=a[m+n]+1;
   for(i=0;i<m+n+2;i++){
        if(i>0&&all[i]==all[i-1])
            continue;

    cont1=num(all[i],n,a);
    cont2=num(all[i],m,b);
     score1=2*(n-cont1)+3*cont1;
     score2=2*(m-cont2)+3*cont2;
    sum=score1-score2;
    if(sum>C){
        C=sum;
        A=score1;
        B=score2;
    }

   }
   printf("%d:%d\n",A,B);
}
return 0;
}


#include<iostream>
#include<stdio.h>
#include<algorithm>
using namespace std;
const int maxn = 200010;
int a[maxn];
int b[maxn];
int main()
{
    int n,m;
    scanf("%d",&n);
    /*int s = 0;
    int t = 0;
    while(n--)
    {
        scanf("%d",&a[s]);
        ++ s;
    }
    scanf("%d",&m);
    while(m--)
    {
        scanf("%d",&b[t]);
        ++ t;
    }*/
    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]);
    }
    int sum1 = 2 * n;
    int sum2 = 2 * m;
    sort(a,a+n);
    sort(b,b+m);
    int score1 = sum1;
    int score2 = sum2;
    int t = m - 1;
    //int sum11 = sum1;//
    //int sum22 = sum2;   //
    //int great = max(a[n-1],b[m-1]);
        for(int i = n - 1; i > -1; --i)
        {
            sum1 = sum1 + 1;
            for(int j = t; j > -1; --j)
            {
                if(b[j] >= a[i])
                {
                     sum2 = sum2 + 1;
                    t = j - 1;
                }
                else
                    break;

            }
            if(sum1 - sum2 > score1 - score2 || ((sum1 - sum2 == score1 - score2) && sum1 > score1) )
            {
                score1 = sum1;
                score2 = sum2;
            }

            //sum1 = sum11;
            //sum2 = sum22;
        }
    printf("%d:%d\n",score1,score2);
        return 0;
}


#include <cstdio>
#include <algorithm>
using namespace std;
#define LL long long
const int maxn=2000005;
int n,m;
LL a[maxn],b[maxn], c[maxn];
int main()
{
    //freopen ("in.txt","r",stdin);
    int k,i,j,sk,sj,maxx=-4000010,cur,an=0,bn=0,cnt=0;
    LL ans1,ans2;
    scanf("%ld",&n);
    for(i=0;i<n;i++)
    {
        scanf("%lld",&a[i]);
        c[cnt++]=a[i];
    }
    sort(a,a+n);
    scanf("%ld",&m);
    for(i=0;i<m;i++)
    {
        scanf("%lld",&b[i]);
        c[cnt++]=b[i];
    }
    sort(b,b+m);
    sort(c,c+cnt);
    cnt=unique(c,c+cnt)-c;
    c[cnt]=c[cnt-1]+1;
    cnt++;
    sk=0,sj=0;
    for(i=0;i<cnt;i++)
    {
        if(a[n-1]<c[i])
            k=n;
        else
        for(k=sk;k<n;k++)
            if(a[k]>=c[i])
            {
                sk=k;
                break;
            }
        if(b[m-1]<c[i])
            j=m;
        else
        for(j=0;j<m;j++)
            if(b[j]>=c[i])
            {
                sj=j;
                break;
            }
		cur=j-k;
        if(maxx<cur||(maxx==cur&&(m-j)>(n-k)))
        {
            maxx=cur;
            an=k;
            bn=j;
        }
    }
    ans1=2*an+3*(n-an);
    ans2=2*bn+3*(m-bn);
    printf("%lld:%lld\n", ans1,ans2);
    return 0;
}


 #include <stdio.h>

 using namespace std;
 int one[200005],two[200005],all[400005];
 int num(int d,int n,int a[])
 {
     int low=0,high=n-1,mid=n/2;
     while(low<=high)
     {
         if(a[mid]==d)
         {
             while(a[mid]==d){
                mid++;
             }
             return n-mid;
         }
         if(a[mid]>d)
             high=mid-1;
         if(a[mid]<d)
             low=mid+1;
         mid=(high+low)/2;
     }
     return n-high-1;
 }
void sort(int a[],int n){
int i,j,k,index;
for(k=0;k<n-1;k++){
    index=k;
    for(i=k+1;i<n;i++){
        if(a[i]<a[index])
            index=i;
    }
    if(index!=k){
        j=a[index];
        a[index]=a[k];
        a[k]=j;
    }
}
}
 int main()
 {
     int i,t=1,mx=-1000000,n,m;
     cin>>n;
     for(i=0;i<n;i++)
     {
         scanf("%d",&one[i]);
         all[t++]=one[i];
     }

    cin>>m;
     for(i=0;i<m;i++)
     {
         scanf("%d",&two[i]);
         all[t++]=two[i];
     }

    all[0]=0;
     sort(one,n);
     sort(two,m);
     sort(all,m+n+1);
     all[m+n+1]=all[m+n]+1;
     int ans1=3*n,ans2=3*m,tmp1,tmp2,ans;
     for(i=0;i<m+n+2;i++)
     {
         if(i>0&&all[i]==all[i-1])
             continue;
         tmp1=num(all[i],n,one);
         tmp2=num(all[i],m,two);
         ans=(tmp1*3+(n-tmp1)*2)-(tmp2*3+(m-tmp2)*2);
         if(ans>mx)
         {
             mx=ans;
             ans1=tmp1*3+(n-tmp1)*2;
             ans2=tmp2*3+(m-tmp2)*2;
         }
     }
     cout<<ans1<<":"<<ans2<<endl;
     return 0;
 }


#include <cstdio>
#include <algorithm>
using namespace std;
struct dis{
    bool who;
    long long value;
};
dis d[400010];
bool cmp(dis a,dis b){
    if(a.value!=b.value)
        return a.value<b.value;
    else {
        if(a.who==b.who){
            return false;
        }
        else {
            return !a.who;
        }
    }
}
long long nowa,nowb;
long long ansa,ansb;
int main()
{
    int na,nb;
    scanf("%d",&na);
    int cnt=0;
    for(int i=0;i<na;++i){
        scanf("%I64d",&d[cnt].value);
        d[cnt].who=false;
        ++cnt;
    }
    scanf("%d",&nb);
    for(int i=0;i<nb;++i)
    {
        scanf("%I64d",&d[cnt].value);
        d[cnt].who=true;
        ++cnt;
    }
    nowa=3*na;
    nowb=3*nb;
    ansa=3*na;
    ansb=3*nb;
    long long max=nowa-nowb;
    sort(d, d+cnt, cmp);
    for(int i=0;i<cnt;++i){
        if(d[i].who){
            --nowb;
        }
        else {
            --nowa;
        }
        if(nowa-nowb>max){
            max=nowa-nowb;
            ansa=nowa;
            ansb=nowb;
        }
    }
    printf("%I64d:%I64d\n",ansa,ansb);
    return 0;
}


#include <cstdio>
#include <algorithm>
using namespace std;
#define LL long long
const int maxn=1000000;
LL n,m;
LL a[maxn],b[maxn];
int main()
{
  //  freopen ("in.txt","r",stdin);
    LL i,j,max=-1000000,cur,an=0,bn=0;
    LL ans1,ans2;
    scanf("%lld",&n);
    for(i=0;i<n;i++)
        scanf("%lld",&a[i]);
    sort(a,a+n);
    scanf("%lld",&m);
    for(i=0;i<m;i++)
        scanf("%lld",&b[i]);
    sort(b,b+m);
    int t=0;
    for(i=0;i<n;i++)
    {
        t++;
        if(!i||a[i]==a[i-1])
            t--;
        for(j=0;j<m;j++)
            if(b[j]>=a[i])break;
        cur=j-t;
        if(max<cur)
        {
            max=cur;
            an=t;
            bn=j;
        }
    }
    ans1=2*an+3*(n-an);
    ans2=2*bn+3*(m-bn);
    printf("%lld:%lld\n", ans1,ans2);
    return 0;
}


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

#define N 200005
#define M 105
#define mod 1000000007
//#define p 10000007
#define mod2 1000000000
#define ll long long
#define LL long long
#define eps 1e-6
#define inf 100000000
#define maxi(a,b) (a)>(b)? (a) : (b)
#define mini(a,b) (a)<(b)? (a) : (b)

using namespace std;

ll n,m;
ll a[N];
ll b[N];
ll cou;
ll ma;
ll c1;
ll c2;
ll cc1,cc2;
ll ans1,ans2;

void ini()
{
    int i;
    for(i=1;i<=n;i++){
        scanf("%I64d",&a[i]);
    }
    scanf("%I64d",&m);
    for(i=1;i<=m;i++){
        scanf("%I64d",&b[i]);
    }
    sort(a+1,a+1+n);
    sort(b+1,b+1+m);
    cou=0;
    c1=c2=0;
    ma=0;
    cc1=cc2=0;
}

void solve()
{
    ll i=n;
    ll j=m;
    while(i>=1 || j>=1){
        if(i==0) break;
        if(j==0){
            c1++;cou++;i--;
            if(ma<=cou){
                ma=cou;
                cc1=c1;
                cc2=c2;
            }
            continue;
        }
        if(a[i]==b[j]){
            c1++;c2++;i--;j--;
            if(ma==cou){
                cc1=c1;
                cc2=c2;
            }
            continue;
        }
        else if(a[i]>b[j]){
            c1++;i--;cou++;
            if(ma<=cou){
                ma=cou;
                cc1=c1;
                cc2=c2;
            }
            continue;
        }
        else{
            c2++;cou--;j--;
        }
    }
    ans1=3*cc1+2*(n-cc1);
    ans2=3*cc2+2*(m-cc2);
}

void out()
{
    printf("%I64d:%I64d\n",ans1,ans2);
}

int main()
{
    //freopen("data.in","r",stdin);
    //freopen("data.out","w",stdout);
    //scanf("%d",&T);
    //for(int ccnt=1;ccnt<=T;ccnt++)
    //while(T--)
    //scanf("%d%d",&n,&m);
    while(scanf("%I64d",&n)!=EOF)
    {
        ini();
        solve();
        out();
    }
    return 0;
}


#include <cstdio>
#include <algorithm>
using namespace std;

#define N 200001
typedef long long ll;

ll a[N], b[N];

int main() {
	ll n, m;
	scanf("%I64d", &n);
	for (ll i = 0; i < n; i++) {
		scanf("%I64d", &a[i]);
	}
	scanf("%I64d", &m);
	for (ll i = 0; i < m; i++) {
		scanf("%I64d", &b[i]);
	}
	sort(a, a + n);
	sort(b, b + m);
	ll ansa = n * 3, ansb = m * 3, p = 0;
	for (ll k = a[p++], i = 0, j = 0; p < n; k = a[++p]) {
		while (a[i] < k && i < n) {
			i++;
		}
		while (b[j] < k && j < m) {
			j++;
		}
		ll ta = n * 3 - i, tb = m * 3 - j;
		if (ta - tb > ansa - ansb) {
			ansa = ta;
			ansb = tb;
		}
		while (p < n && a[p + 1] == a[p]) {
			p++;
		}
	}
	printf("%I64d:%I64d\n", ansa, ansb);
	return 0;
}


#include <cstdio>
#include <algorithm>
using namespace std;
const int maxn=200005;
int num1,num2,n,m;
int a[maxn],b[maxn],c[maxn];
void A(int x)
{
    for(int i=0;i<n;i++)
        if(a[i]<c[x])
            num1++;
	for(int j=0;j<m;j++)
		if(b[j]<c[x])
			num2++;
}

int main()
{
    //freopen ("in.txt","r",stdin);
    int i,ans1,ans2,sum1,sum2,max=0,cur,cnt=0;
    scanf("%d",&n);
    for(i=0;i<n;i++)
	{
        scanf("%d",&a[i]);
		c[cnt++]=a[i];
	}
    scanf("%d",&m);
    for(i=0;i<m;i++)
	{
        scanf("%d",&b[i]);
		c[cnt++]=b[i];
	}
    sort(c,c+cnt);
	cnt=unique(c,cnt+c)-c;
	c[cnt]=c[cnt-1]+1;
    for(i=0;i<=cnt;i++)
    {
        num1=0,num2=0;
        A(i);
        sum1=2*num1+3*(n-num1);
        sum2=2*num2+3*(m-num2);
        if(sum1>=sum2)
            cur=sum1-sum2;
        else
            cur=sum2-sum1;
        if(max<cur||(max==cur&&ans1<sum1))
        {
            ans1=sum1;
            ans2=sum2;
            max=cur;
        }
    }
    printf("%d:%d\n", ans1,ans2);
    return 0;
}


#include<stdio.h>
#include <iostream>
#include <algorithm>
using namespace std;
int a[333333],b[333333],all[333333*2];
int num(int d,int n,int a[])
 {
     int low=0,high=n-1,mid=n/2;
     while(low<=high)
     {
         if(a[mid]==d)
         {
             while(a[mid]==d){
                mid++;
             }
             return n-mid;
         }
         if(a[mid]>d)
             high=mid-1;
         if(a[mid]<d)
             low=mid+1;
         mid=(high+low)/2;
     }
     return n-high-1;
 }
int main(){

int n,m,i,t=1,cont1,cont2,C=-10000000,sum,score1,score2,A=3*n,B=3*m;

while((scanf("%d",&n))!=EOF){
   for(i=0;i<n;i++){
    scanf("%d",&a[i]);
    all[t++]=a[i];
   }
   scanf("%d",&m);
   for(i=0;i<m;i++){
    scanf("%d",&b[i]);
    all[t++]=b[i];
   }
    all[0]=0;
   sort(a,a+n);
     sort(b,b+m);
     sort(all,all+(m+n+1));
   all[m+n+1]=a[m+n]+1;
   for(i=0;i<m+n+2;i++){
        if(i>0&&all[i]==all[i-1])
            continue;

    cont1=num(all[i],n,a);
    cont2=num(all[i],m,b);
     score1=2*(n-cont1)+3*cont1;
     score2=2*(m-cont2)+3*cont2;
    sum=score1-score2;
    if(sum>C){
        C=sum;
        A=score1;
        B=score2;
    }

   }
   printf("%d:%d\n",A,B);
}
return 0;
}


#include <cstdio>
#include <algorithm>
using namespace std;
const int maxn=200005;
int num1,num2,n,m;
int a[maxn],b[maxn];
void A(int x)
{
    for(int i=0;i<=n;i++)
    {
        if(a[i]<a[x])
            num1++;
        if(b[i]<a[x]&&i<m)
            num2++;
    }
}
void B(int x)
{
    for(int i=0;i<=m;i++)
    {
        if(a[i]<b[x]&&i<n)
            num1++;
        if(b[i]<b[x])
            num2++;
    }
}
int main()
{
    //freopen ("in.txt","r",stdin);
    int i,ans1,ans2,sum1,sum2,max=0,cur;
    scanf("%d",&n);
    for(i=0;i<n;i++)
        scanf("%d",&a[i]);
    sort(a,n+a);
	a[n-1]=a[n];
    scanf("%d",&m);
    for(i=0;i<m;i++)
        scanf("%d",&b[i]);
    sort(b,b+m);
	b[m-1]=b[m];
    for(i=0;i<=n;i++)
    {
        num1=0,num2=0;
        A(i);
        sum1=2*num1+3*(n-num1);
        sum2=2*num2+3*(m-num2);
        if(sum1>=sum2)
            cur=sum1-sum2;
        else
            cur=sum2-sum1;
        if(max<cur||(max==cur&&ans1<sum1))
        {
            ans1=sum1;
            ans2=sum2;
            max=cur;
        }
    }
	for(i=0;i<=m;i++)
    {
        num1=0,num2=0;
        B(i);
        sum1=2*num1+3*(n-num1);
        sum2=2*num2+3*(m-num2);
        if(sum1>=sum2)
            cur=sum1-sum2;
        else
            cur=sum2-sum1;
        if(max<cur||(max==cur&&ans1<sum1))
        {
            ans1=sum1;
            ans2=sum2;
            max=cur;
        }
    }
    printf("%d:%d\n", ans1,ans2);
    return 0;
}


#include <cstdio>
#include <algorithm>
using namespace std;
#define LL long long
const int maxn=1000005;
LL n,m;
LL a[maxn],b[maxn], c[maxn];
int main()
{
  //  freopen ("in.txt","r",stdin);
    LL k,i,j,ans1,ans2,max=-1000000,cur,an=0,bn=0,cnt=0;
    scanf("%lld",&n);
    for(i=0;i<n;i++)
    {
        scanf("%lld",&a[i]);
        c[cnt++]=a[i];
    }
    sort(a,a+n);
    scanf("%lld",&m);
    for(i=0;i<m;i++)
    {
        scanf("%lld",&b[i]);
        c[cnt++]=b[i];
    }
    sort(b,b+m);
    sort(c,c+cnt);
    cnt=unique(c,c+cnt)-c;
    for(i=0;i<cnt;i++)
    {
        for(k=0;k<n;k++)
            if(a[k]>=c[i])break;
        for(j=0;j<m;j++)
            if(b[j]>=c[i])break;
		cur=j-k;
        if(max<cur)
        {
            max=cur;
            an=k;
            bn=j;
        }
    }
    ans1=2*an+3*(n-an);
    ans2=2*bn+3*(m-bn);
    printf("%lld:%lld\n", ans1,ans2);
    return 0;
}


#include <cstdio>
#include <algorithm>
using namespace std;
const int maxn=200005;
int num1,num2,n,m,len;
int a[maxn],b[maxn];
void A(int x)
{
    for(int i=0;i<len;i++)
    {
        if(a[i]<a[x]&&i<n)
            num1++;
        if(b[i]<a[x]&&i<m)
            num2++;
    }
}
int main()
{
    //freopen ("in.txt","r",stdin);
    int i,ans1,ans2,sum1,sum2,max=0,cur;
    scanf("%d",&n);
    for(i=0;i<n;i++)
        scanf("%d",&a[i]);
    sort(a,n+a);
    scanf("%d",&m);
    for(i=0;i<m;i++)
        scanf("%d",&b[i]);
    sort(b,b+m);
	len=n>m?n:m;
    for(i=0;i<n;i++)
    {
        num1=0,num2=0;
        A(i);
        sum1=2*num1+3*(n-num1);
        sum2=2*num2+3*(m-num2);
        if(sum1>=sum2)
            cur=sum1-sum2;
        else
            cur=sum2-sum1;
        if(max<cur||(max==cur&&ans1<sum1))
        {
            ans1=sum1;
            ans2=sum2;
            max=cur;
        }
    }
    printf("%d:%d\n", ans1,ans2);
    return 0;
}


#include <cstdio>
#include <algorithm>
using namespace std;
const int maxn=200005;
int num1,num2,n,m;
int a[maxn],b[maxn],c[maxn];
void A(int x)
{
    for(int i=0;i<n;i++)
        if(a[i]<c[x])
            num1++;
	for(int j=0;j<m;j++)
		if(b[j]<c[x])
			num2++;
}
int main()
{
    //freopen ("in.txt","r",stdin);
    int i,ans1,ans2,tn,max=-100000,cur,cnt=0;
    scanf("%d",&n);
    for(i=0;i<n;i++)
	{
        scanf("%d",&a[i]);
		c[cnt++]=a[i];
	}
    scanf("%d",&m);
    for(i=0;i<m;i++)
	{
        scanf("%d",&b[i]);
		c[cnt++]=b[i];
	}
    sort(c,c+cnt);
	cnt=unique(c,cnt+c)-c;
	cnt=m>n?m:n;
    for(i=0;i<=cnt;i++)
    {
        num1=0,num2=0;
        A(i);
        cur=num2-num1;
        if(max<cur||(max==cur&&num1<tn))
        {
            ans1=2*num1+3*(n-num1);
            ans2=2*num2+3*(m-num2);
            max=cur;
			tn=num1;
        }
    }
    printf("%d:%d\n", ans1,ans2);
    return 0;
}


#include<stdio.h>
#include <iostream>
#include <algorithm>
int a[333333],b[333333],all[333333*2];
int num(int d,int n,int a[])
 {
     int low=0,high=n-1,mid=n/2;
     while(low<=high)
     {
         if(a[mid]==d)
         {
             while(a[mid]==d){
                mid++;
             }
             return n-mid;
         }
         if(a[mid]>d)
             high=mid-1;
         if(a[mid]<d)
             low=mid+1;
         mid=(high+low)/2;
     }
     return n-high-1;
 }
int main(){

int n,m,i,d,t=1,cont1,cont2,C=-10000000,sum,score1,score2,A,B;
all[0]=0;
while((scanf("%d",&n))!=EOF){
   for(i=0;i<n;i++){
    scanf("%d",&a[i]);
    all[t++]=a[i];
   }
   scanf("%d",&m);
   for(i=0;i<m;i++){
    scanf("%d",&b[i]);
    all[t++]=b[i];
   }
   sort(a,a+n);
     sort(b,b+m);
     sort(all,all+(m+n+1));
   all[m+n+1]=a[m+n]+1;
   for(i=0;i<m+n+2;i++){
        if(i>0&&all[i]==all[i-1])
            continue;

    cont1=num(all[i],n,a);
    cont2=num(all[i],m,b);
     score1=2*(n-cont1)+3*cont1;
     score2=2*(m-cont2)+3*cont2;
    sum=score1-score2;
    if(sum>C||(sum==C&&score1>A)){
        C=sum;
        A=score1;
        B=score2;
    }

   }
   printf("%d:%d\n",A,B);
}
return 0;
}


#include <iostream>
#define ll long long
using namespace std;
int const MAX = 200005;
ll a[MAX], b[MAX];

int min(ll a, ll b)
{
    return a > b ? b : a;
}

int main()
{
    int n, m, cnt = 0;
    ll ma = -1, asum, bsum;
    scanf("%d", &n);
    for(int i = 0; i < n; i++)
        cin >> a[i];
    scanf("%d", &m);
    for(int i = 0; i < m; i++)
    {
        cin >> b[i];
        if(b[i] > ma)
            ma = b[i];
    }
    for(int i = 0; i < n; i++)
        if(a[i] > ma)
            cnt++;
    if(n < m)
    {
        asum = 3 * cnt + 2 * (n - cnt);
        bsum = 2 * m;
    }
    else
    {
        asum = 3 * n;
        bsum = 3 * m;
    }
    cout << asum << ":" << bsum << endl;
}


#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
const int maxn=200005;
int n,m;
int a[maxn],b[maxn];
int main()
{
  //  freopen ("in.txt","r",stdin);
    int i,j,ans1,ans2,max=-100000,cur,an=0,bn=0;
    scanf("%d",&n);
    for(i=0;i<n;i++)
        scanf("%d",&a[i]);
    sort(a,a+n);
    scanf("%d",&m);
    for(i=0;i<m;i++)
        scanf("%d",&b[i]);
    sort(b,b+m);
    int t=0;
    for(i=0;i<n;i++)
    {
        t++;
        if(!i||a[i]==a[i-1])
            t--;
        for(j=0;j<m;j++)
            if(b[j]>=a[i])break;
        cur=j-t;
        if(max<cur)
        {
            max=cur;
            an=t;
            bn=j;
        }
    }
    ans1=2*an+3*(n-an);
    ans2=2*bn+3*(m-bn);
    printf("%d:%d\n", ans1,ans2);
    return 0;
}


#include <iostream>
 #include <stdio.h>
 #include <algorithm>
 using namespace std;
 int one[200005],two[200005],all[400005];
 int num(int a[],int n,int d){
int low=0,high=n-1,mid=n/2;
while(low<=high){
    if(a[mid]==d)
        return mid+1;
    else if(a[mid]>d){
        high=mid-1;
        mid=(low+high)/2;
    }
    else{
        low=mid+1;
        mid=(low+high)/2;
    }
}
}
 int main()
 {
     int i,t=1,mx=-1000000,n,m;
     cin>>n;
     for(i=0;i<n;i++)
     {
         scanf("%d",&one[i]);
         all[t++]=one[i];
     }

    cin>>m;
     for(i=0;i<m;i++)
     {
         scanf("%d",&two[i]);
         all[t++]=two[i];
     }

    all[0]=0;
     sort(one,one+n);
     sort(two,two+m);
     sort(all,all+(m+n+1));
     all[m+n+1]=all[m+n]+1;
     int ans1=3*n,ans2=3*m,tmp1,tmp2,ans;
     for(i=0;i<m+n+2;i++)
     {
         if(i>0&&all[i]==all[i-1])
             continue;
         tmp1=num(one,n,all[i]);
         tmp2=num(two,m,all[i]);
         ans=(tmp1*2+(n-tmp1)*3)-(tmp2*2+(m-tmp2)*3);
         if(ans>mx)
         {
             mx=ans;
             ans1=tmp1*2+(n-tmp1)*3;
             ans2=tmp2*2+(m-tmp2)*3;
         }
     }
     cout<<ans1<<":"<<ans2<<endl;
     return 0;
 }


#include <cstdio>
#include <algorithm>
using namespace std;
const int maxn=200005;
int num1,num2,n,m;
int a[maxn],b[maxn];
void A(int x)
{
    for(int i=0;i<n;i++)
    {
        if(a[i]<a[x])
		{
            num1++;
		//	printf("%d %d\n",a[i],a[x]);
		}
        if(b[i]<a[x]&&i<m)
            num2++;
    }
}
void B(int x)
{
    for(int i=0;i<m;i++)
    {
        if(a[i]<b[x]&&i<n)
            num1++;
        if(b[i]<b[x])
            num2++;
    }
}
int main()
{
    //freopen ("in.txt","r",stdin);
    int i,ans1,ans2,sum1,sum2,max=0,cur;
    scanf("%d",&n);
    for(i=0;i<n;i++)
        scanf("%d",&a[i]);
    sort(a,n+a);
	a[n]=a[n-1]+1;
    scanf("%d",&m);
    for(i=0;i<m;i++)
        scanf("%d",&b[i]);
    sort(b,b+m);
	b[m]=b[m-1]+1;
    for(i=0;i<=n;i++)
    {
        num1=0,num2=0;
        A(i);
        sum1=2*num1+3*(n-num1);
        sum2=2*num2+3*(m-num2);
        if(sum1>=sum2)
            cur=sum1-sum2;
        else
            cur=sum2-sum1;
        if(max<cur||(max==cur&&ans1<sum1))
        {
            ans1=sum1;
            ans2=sum2;
            max=cur;
        }
    }
	for(i=0;i<=m;i++)
    {
        num1=0,num2=0;
        B(i);
        sum1=2*num1+3*(n-num1);
        sum2=2*num2+3*(m-num2);
        if(sum1>=sum2)
            cur=sum1-sum2;
        else
            cur=sum2-sum1;
        if(max<cur||(max==cur&&ans1<sum1))
        {
            ans1=sum1;
            ans2=sum2;
            max=cur;
        }
    }
    printf("%d:%d\n", ans1,ans2);
    return 0;
}


#include <cstdio>
#include <algorithm>
using namespace std;
const int maxn=1000005;
int n,m;
int a[maxn],b[maxn];
int c[maxn];
int main()
{
    freopen ("in.txt","r",stdin);
    int k,i,j,ans1,ans2,max=-1000000,cur,an=0,bn=0,cnt=0;
    scanf("%d",&n);
    for(i=0;i<n;i++)
    {
        scanf("%d",&a[i]);
        c[cnt++]=a[i];
    }
    sort(a,a+n);
    scanf("%d",&m);
    for(i=0;i<m;i++)
    {
        scanf("%d",&b[i]);
        c[cnt++]=b[i];
    }
    sort(b,b+m);
    sort(c,c+cnt);
    cnt=unique(c,c+cnt)-c;
	c[cnt]=c[cnt-1]+1;
    for(i=0;i<=cnt;i++)
    {
        for(k=0;k<n;k++)
            if(a[k]>=c[i])break;
        for(j=0;j<m;j++)
            if(b[j]>=c[i])break;
		cur=j-k;
        if(max<cur)
        {
            max=cur;
            an=k;
            bn=j;
        }
    }
    ans1=2*an+3*(n-an);
    ans2=2*bn+3*(m-bn);
    printf("%d:%d\n", ans1,ans2);
    return 0;
}


#include<iostream>
#include<stdio.h>
#include<algorithm>
using namespace std;
const int maxn = 200050;
int a[maxn];
int b[maxn];
int main()
{
    int n,m;
    scanf("%d",&n);
    /*int s = 0;
    int t = 0;
    while(n--)
    {
        scanf("%d",&a[s]);
        ++ s;
    }
    scanf("%d",&m);
    while(m--)
    {
        scanf("%d",&b[t]);
        ++ t;
    }*/
    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]);
    }
    int sum1 = 2 * n;
    int sum2 = 2 * m;
    sort(a,a+n);
    sort(b,b+m);
    int score1 = sum1;
    int score2 = sum2;
    //int great = max(a[n-1],b[m-1]);
        for(int i = n - 1; i > -1; --i)
        {
            int sum11 = sum1 + 1;
            int t = m - 1;
            int sum22 = sum2;
            for(int j = t; j > -1; --j)
            {
                if(b[j] >= a[i])
                {
                     sum22 = sum2 + 1;
                }
                t = j;

            }
            if(sum11 - sum22 > score1- score2 || ((sum11 - sum22 == score1 - score2) && sum11 > score1) )
            {
                score1 = sum11;
                score2 = sum22;
            }

            sum1 = sum11;
            sum2 = sum22;
        }
    printf("%d:%d\n",score1,score2);
        return 0;
}


#include <iostream>
#define ll long long
using namespace std;
int const MAX = 200005;
ll a[MAX], b[MAX];

int min(ll a, ll b)
{
    return a > b ? b : a;
}

int main()
{
    int n, m, cnt = 0;
    ll ma = -1, asum, bsum;
    cin >> n;
    for(int i = 0; i < n; i++)
        cin >> a[i];
    cin >> m;
    for(int i = 0; i < m; i++)
    {
        cin >> b[i];
        if(b[i] > ma)
            ma = b[i];
    }
    for(int i = 0; i < n; i++)
        if(a[i] > ma)
            cnt++;
    if(n < m)
    {
        asum = 3 * cnt + 2 * (n - cnt);
        bsum = 2 * m;
    }
    else
    {
        asum = 3 * n;
        bsum = 3 * m;
    }
    cout << asum << ":" << bsum << endl;
}


t=int(input())
ans=[]
for i in range(t):
    a,b,n,m=input().split()
    a=int(a)
    b=int(b)
    n=int(n)
    m=int(m)
    if(a+b)<(m+n):
        ans.append("No")
        continue
    else:
        if(a==0 or b==0 and(m!=0)):
            ans.append("No")
            continue
        if(a==0 or b==0 and(m==0)):
            ans.append("Yes")
            continue
        if(min(a,b)>=m):
            ans.append("Yes")
            continue
        if(min(a,b)<m and(a+b==m+n)):
            ans.append("Yes")    #no originally
            continue

        if(min(a,b)<m and(a+b>m+n)):
            ans.append("No")    # no originally
            continue
        #if(min(a,b)<m and(max(a,b)-n)>=min(a,b))
        """if(min(a,b)<m):
            if(max(a,b)-n<min(a,b))and(max(a,b)-n>=m ):
                ans.append("Yes")
                continue
            if()"""

for an in ans:
    print(an)


t=int(input())
ans=[]
for i in range(t):
    a,b,n,m=input().split()
    a=int(a)
    b=int(b)
    n=int(n)
    m=int(m)
    if(a+b)<(m+n):
        ans.append("No")
        continue
    else:
        if(a==0 or b==0 and(m!=0)):
            ans.append("No")
            continue
        if(a==0 or b==0 and(m==0)):
            ans.append("Yes")
            continue
        if(min(a,b)>=m):
            ans.append("Yes")
            continue
        """if(min(a,b)<m and(a+b==m+n)):
            ans.append("No")    #no originally
            continue"""

        if(min(a,b)<m and(a+b>=m+n)):
            if(max(a,b)-n>=min(a,b)):
                ans.append("No")
                continue
            else:

                ans.append("No")    # no originally
                continue
        #if(min(a,b)<m and())
        #if(min(a,b)<m and(max(a,b)-n)>=min(a,b))
        """if(min(a,b)<m):
            if(max(a,b)-n<min(a,b))and(max(a,b)-n>=m ):
                ans.append("Yes")
                continue
            if()"""

for an in ans:
    print(an)


t=int(input())
ans=[]
for i in range(t):
    a,b,n,m=input().split()
    a=int(a)
    b=int(b)
    n=int(n)
    m=int(m)
    if(a+b)<(m+n):
        ans.append("No")
        continue
    else:
        if(a==0 or b==0 and(m!=0)):
            ans.append("No")
            continue
        if(a==0 or b==0 and(m==0)):
            ans.append("Yes")
            continue
        if(min(a,b)>=m):
            ans.append("Yes")
            continue
        if(min(a,b)<m and(a+b==m+n)):
            ans.append("Yes")    #no originally
            continue

        if(min(a,b)<m and(a+b>m+n)):
            ans.append("Yes")    # no originally
            continue

for an in ans:
    print(an)


t=int(input())
ans=[]
for i in range(t):
    a,b,n,m=input().split()
    a=int(a)
    b=int(b)
    n=int(n)
    m=int(m)
    if(a+b)<(m+n):
        ans.append("No")
        continue
    else:
        if(a==0 or b==0 and(m!=0)):
            ans.append("No")
            continue
        if(a==0 or b==0 and(m==0)):
            ans.append("Yes")
            continue
        if(min(a,b)>=m):
            ans.append("Yes")
            continue
        """if(min(a,b)<m and(a+b==m+n)):
            ans.append("No")    #no originally
            continue"""

        if(min(a,b)<m and(a+b>=m+n)):
            if(max(a,b)-n>min(a,b)):
                ans.append("No")
                continue
            else:

                ans.append("Yes")    # no originally
                continue
        #if(min(a,b)<m and())
        #if(min(a,b)<m and(max(a,b)-n)>=min(a,b))
        """if(min(a,b)<m):
            if(max(a,b)-n<min(a,b))and(max(a,b)-n>=m ):
                ans.append("Yes")
                continue
            if()"""

for an in ans:
    print(an)


t=int(input())
ans=[]
for i in range(t):
    a,b,n,m=input().split()
    a=int(a)
    b=int(b)
    n=int(n)
    m=int(m)
    if(a+b)<(m+n):
        ans.append("No")
        continue
    else:
        if(a==0 or b==0 and(m!=0)):
            ans.append("No")
            continue
        if(a==0 or b==0 and(m==0)):
            ans.append("Yes")
            continue
        if(min(a,b)>=m):
            ans.append("Yes")
            continue
        if(min(a,b)<m and(a+b==m+n)):
            ans.append("No")    #no originally
            continue

        if(min(a,b)<m and(a+b>m+n)):
            ans.append("Yes")    # no originally
            continue

for an in ans:
    print(an)


t=int(input())
ans=[]
for i in range(t):
    a,b,n,m=input().split()
    a=int(a)
    b=int(b)
    n=int(n)
    m=int(m)
    if(a+b)<(m+n):
        ans.append("No")
        continue
    else:
        if(a==0 or b==0 and(m!=0)):
            ans.append("No")
            continue
        if(a==0 or b==0 and(m==0)):
            ans.append("Yes")
            continue
        if(min(a,b)>=m):
            ans.append("Yes")
            continue
        """if(min(a,b)<m and(a+b==m+n)):
            ans.append("No")    #no originally
            continue"""

        if(min(a,b)<m and(a+b>=m+n)):
            if(max(a,b)-n>=min(a,b)):
                ans.append("No")
                continue
            else:

                ans.append("Yes")    # no originally
                continue
        #if(min(a,b)<m and())
        #if(min(a,b)<m and(max(a,b)-n)>=min(a,b))
        """if(min(a,b)<m):
            if(max(a,b)-n<min(a,b))and(max(a,b)-n>=m ):
                ans.append("Yes")
                continue
            if()"""

for an in ans:
    print(an)