for t in range(int(input())):
    n=int(input())
    lst=list(map(int,input().split()))
    even=[]
    odd=[]
    for i in range(len(lst)):
        if(lst[i]%2==0):
            even.append([lst[i],i])
        else:
            odd.append([lst[i],i])

    l1=len(even)
    l2=len(odd)

    flag=0
    if(l1%2==0 and l2%2==0):
        flag=1
    elif((l1-1)%2==0 and (l2-1)%2==0):
        flag=2

    if(flag==1):
        if(len(odd)>=2):
            odd.remove(min(odd))
            odd.remove(min(odd))
        else:
            even.remove(min(even))
            even.remove(min(even))
        c=0
        for i in range(len(even)):
            print(even[i][1]+1,end=" ")
            c+=1
            if(c%2==0):
                print()
        for i in range(len(odd)):
            print(odd[i][1]+1,end=" ")
            c+=1
            if(c%2==0):
                print()

    elif(flag==2):
        a=min(odd)
        b=min(even)
        odd.remove(a)
        even.remove(b)
        c=0
        for i in range(len(even)):
            print(even[i][1]+1,end=" ")
            c+=1
            if(c%2==0):
                print()
        for i in range(len(odd)):
            print(odd[i][1]+1,end=" ")
            c+=1
            if(c%2==0):
                print()


def read_int():
    return int(input())

def read_string_array():
    return input().split()

def read_int_array():
    return [int(_) for _ in read_string_array()]

def read_line():
    return input()

def solve(n, a):
    evens = [_ for _, __ in enumerate(a) if not _ & 1]
    odds = [_ for _, __ in enumerate(a) if _ & 1]
    if len(odds) & 1:
        evens.pop()
        odds.pop()
    else:
        evens.pop()
        evens.pop()
    arr = evens + odds
    for item1, item2 in zip(arr[::2], arr[1::2]):
        print(item1+1, item2+1)

if __name__ == '__main__':
    T = read_int()
    for _ in range(T):
        #  read inputs

        N = read_int()
        A = read_int_array()
        # read_string_array()

        # solve
        solve(N, A)


def read_int():
    return int(input())

def read_string_array():
    return input().split()

def read_int_array():
    return [int(_) for _ in read_string_array()]

def read_line():
    return input()

def solve(n, a):
    odds = [_+1 for _, __ in enumerate(a) if not _ & 1]
    evens = [_+1 for _, __ in enumerate(a) if _ & 1]
    if len(odds) & 1:
        evens.pop()
        odds.pop()
    else:
        evens.pop()
        evens.pop()
    arr = evens + odds
    for item1, item2 in zip(arr[::2], arr[1::2]):
        print(item1, item2)

if __name__ == '__main__':
    T = read_int()
    for _ in range(T):
        #  read inputs

        N = read_int()
        A = read_int_array()
        # read_string_array()

        # solve
        solve(N, A)


def read_int():
    return int(input())

def read_string_array():
    return input().split()

def read_int_array():
    return [int(_) for _ in read_string_array()]

def read_line():
    return input()

def solve(n, a):
    odds = [_+1 for _, __ in enumerate(a) if not __ & 1]
    evens = [_+1 for _, __ in enumerate(a) if __ & 1]
    if len(odds) & 1:
        evens.pop()
        odds.pop()
    else:
        if len(evens) > 0:
            evens.pop()
            evens.pop()
        else:
            odds.pop()
            odds.pop()
    arr = evens + odds
    # print([a[_] for _ in arr])
    for item1, item2 in zip(arr[::2], arr[1::2]):
        print(item1, item2)

if __name__ == '__main__':
    T = read_int()
    for _ in range(T):
        #  read inputs

        N = read_int()
        A = read_int_array()
        # read_string_array()

        # solve
        solve(N, A)


def read_int():
    return int(input())

def read_string_array():
    return input().split()

def read_int_array():
    return [int(_) for _ in read_string_array()]

def read_line():
    return input()

def solve(n, a):
    evens = [_ for _, __ in enumerate(a) if not _ & 1]
    odds = [_ for _, __ in enumerate(a) if _ & 1]
    if len(odds) & 1:
        evens.pop()
        odds.pop()
    else:
        evens.pop()
        evens.pop()
    arr = evens + odds
    for item1, item2 in zip(arr[::2], arr[1::2]):
        print(item1, item2)

if __name__ == '__main__':
    T = read_int()
    for _ in range(T):
        #  read inputs

        N = read_int()
        A = read_int_array()
        # read_string_array()

        # solve
        solve(N, A)


t = int(input())
for _ in range(t) :
    n = int(input())
    arr = list(map(int,input().split()))
    even = list()
    odd = list()
    i = 0

    j = (2*n)-1
    for _ in range(n)  :
        if arr[i]%2 == 0 :
            even.append(i+1)
        if arr[i]%2 == 1 :
            odd.append(i+1)
        if arr[j]%2 == 0 :
            even.append(j+1)
        if arr[j]%2 == 1 :
            odd.append(j+1)
        i+=1
        j = j - 1

    # print(even,odd)

    cnt = 0
    i = 0
    while True :
        if i > len(even) - 2 or cnt == (n-1):
            break
        print(even[i],even[i+1])
        cnt+=1
        i+=2

    if cnt == (n-1) :
        break

    i = 0
    while True :
        if i > len(odd) - 2 or cnt == (n-1):
            break
        print(odd[i],odd[i+1])
        cnt+=1
        i+=2


t = int(input())
for _ in range(t) :
    n = int(input())
    arr = list(map(int,input().split()))
    even = list()
    odd = list()
    # i = 0

    # j = (2*n)-1
    # for _ in range(n)  :
    #     if arr[i]%2 == 0 :
    #         even.append(i+1)
    #     if arr[i]%2 == 1 :
    #         odd.append(i+1)
    #     if arr[j]%2 == 0 :
    #         even.append(j+1)
    #     if arr[j]%2 == 1 :
    #         odd.append(j+1)
    #     i+=1
    #     j = j - 1
    for i in range(2*n) :
        if arr[i] % 2 == 0 :
            even.append(i+1)
        else :
            odd.append(i+1)

    print(even,odd)

    cnt = 0
    i = 0
    while True :
        if i > len(even) - 2 or cnt == (n-1):
            break
        print(even[i],even[i+1])
        cnt+=1
        i+=2

    if cnt == (n-1) :
        break

    i = 0
    while True :
        if i > len(odd) - 2 or cnt == (n-1):
            break
        print(odd[i],odd[i+1])
        cnt+=1
        i+=2


for _ in range(int(input())) :
    n = int(input())
    arr = list(map(int,input().split()))
    even = list()
    odd = list()
    # i = 0

    # j = (2*n)-1
    # for _ in range(n)  :
    #     if arr[i]%2 == 0 :
    #         even.append(i+1)
    #     if arr[i]%2 == 1 :
    #         odd.append(i+1)
    #     if arr[j]%2 == 0 :
    #         even.append(j+1)
    #     if arr[j]%2 == 1 :
    #         odd.append(j+1)
    #     i+=1
    #     j = j - 1
    for i in range(2*n) :
        if arr[i] % 2 == 0 :
            even.append(i+1)
        else :
            odd.append(i+1)

    cnt = 0
    i = 0
    while True :
        if cnt == (n-1):
            break
        elif i > len(even) - 2 :
            break
        else :
            print(even[i],even[i+1])
            cnt+=1
            i+=2

    if cnt != (n-1) :
        i = 0
        while True :
            if cnt == (n-1):
                break
            elif i > len(odd) - 2 :
                break
            else :
                print(odd[i],odd[i+1])
                cnt+=1
                i+=2


t = int(input())
for _ in range(t) :
    n = int(input())
    arr = list(map(int,input().split()))
    even = list()
    odd = list()
    # i = 0

    # j = (2*n)-1
    # for _ in range(n)  :
    #     if arr[i]%2 == 0 :
    #         even.append(i+1)
    #     if arr[i]%2 == 1 :
    #         odd.append(i+1)
    #     if arr[j]%2 == 0 :
    #         even.append(j+1)
    #     if arr[j]%2 == 1 :
    #         odd.append(j+1)
    #     i+=1
    #     j = j - 1
    for i in range(2*n) :
        if arr[i] % 2 == 0 :
            even.append(i+1)
        else :
            odd.append(i+1)

    cnt = 0
    i = 0
    while True :
        if cnt == (n-1):
            break
        elif i > len(even) - 2 :
            break
        else :
            print(even[i],even[i+1])
            cnt+=1
            i+=2

    if cnt == (n-1) :
        break

    i = 0
    while True :
        if cnt == (n-1):
            break
        elif i > len(odd) - 2 :
            break
        else :
            print(odd[i],odd[i+1])
            cnt+=1
            i+=2


t = int(input())
for _ in range(t) :
    n = int(input())
    arr = list(map(int,input().split()))
    even = list()
    odd = list()
    # i = 0

    # j = (2*n)-1
    # for _ in range(n)  :
    #     if arr[i]%2 == 0 :
    #         even.append(i+1)
    #     if arr[i]%2 == 1 :
    #         odd.append(i+1)
    #     if arr[j]%2 == 0 :
    #         even.append(j+1)
    #     if arr[j]%2 == 1 :
    #         odd.append(j+1)
    #     i+=1
    #     j = j - 1
    for i in range(2*n) :
        if arr[i] % 2 == 0 :
            even.append(i+1)
        else :
            odd.append(i+1)

    # print(even,odd)

    cnt = 0
    i = 0
    while True :
        if i > len(even) - 2 or cnt == (n-1):
            break
        print(even[i],even[i+1])
        cnt+=1
        i+=2

    if cnt == (n-1) :
        break

    i = 0
    while True :
        if i > len(odd) - 2 or cnt == (n-1):
            break
        print(odd[i],odd[i+1])
        cnt+=1
        i+=2


t=int(input())
for i in range(t):
	n=int(input())
	co=[]
	ce=[]
	a=list(map(int,input().strip().split()))[:2*n]
	for j in range(2*n):
		if(a[j]%2==0):
			ce.append(j+1)
		else:
			co.append(j+1)
	count=0
	for j in range(0,len(co),2):
		if(count==(n-1)):
			break
		print(co[j],co[j+1])
		count=count+1
	for j in range(0,len(ce),2):
		if(count==(n-1)):
			break
		print(ce[j],ce[j+1])
		count=count+1


t=int(input())
for i in range(t):
	n=int(input())
	co=[]
	ce=[]
	a=list(map(int,input().strip().split()))[:2*n]
	for j in range(2*n):
		if(a[j]%2==0):
			ce.append(j+1)
		else:
			co.append(j+1)
	count=0
	for j in range(0,len(co),2):
		if(count==(n-1) or (j+1)>=len(co)):
			break
		print(co[j],co[j+1])
		count=count+1
	for j in range(0,len(ce),2):
		if(count==(n-1) or (j+1)>=len(ce)):
			break
		print(ce[j],ce[j+1])
		count=count+1


t=int(input())
for i in range(t):
	n=int(input())
	a=list(map(int,input().strip().split()))[:2*n]
	for j in range(n-1):
		f=False
		for k in range(2*n):
			#print(k)
			for l in range(2*n):
				#print(l)
				if(k!=l):
					if(((a[k]+a[l])%2==0) and (a[k]!=0) and (a[l]!=0)):
						print((k+1),(l+1))
						a[k]=0
						a[l]=0
						f=True
						break
			if(f):
				f=False
				break


t=int(input())
for i in range(t):
	n=int(input())
	a=[]
	for j in range(2*n):
		a.append(int(input()))
	for j in range(n-1):
		for k in range(2*n):
			for l in range(2*n):
				if(k!=l):
					if((a[k]+a[l]%2==0) and a[k]!=0 and a[l]!=0):
						print(k+" "+l)
						a[k]=0
						a[l]=0
						break


t=int(input())
for _ in range(t):
    n=int(input())
    a=list(map(int,input().split()))
    seen=[0]*(2*n)
    b=[]
    for i in range(2*n):
        if seen[i]==0:
            for j in range(i+1,2*n):
                if (a[i]+a[j])%2==0:
                    b.append([i+1,j+1])
                    seen[i]=1
                    seen[i]=1
                    break
    for i in range(n-1):
        print(*b[i])


t=int(input())
for _ in range(t):
    n=int(input())
    a=list(map(int,input().split()))
    even=[]
    odd=[]
    for i in range(len(a)):
        if a[i]%2==0:
            even.append(i)
        else:
            odd.append(i)

    for i in range(n-1):
        print(odd[i]+1,even[i]+1)


t=int(input())
for _ in range(t):
    n=int(input())
    a=list(map(int,input().split()))
    seen=[0]*(2*n)
    b=[]
    for i in range(2*n):
        if seen[i]==0:
            for j in range(i+1,2*n):
                if (a[i]+a[j])%2==0:
                    b.append([i+1,j+1])
                    seen[i]=1
                    seen[j]=1
                    break
    for i in range(n-1):
        print(*b[i])


t=int(input())
for _ in range(t):
    n=int(input())
    a=list(map(int,input().split()))
    a.sort()
    b=a[0]+a[1]
    if n==2:
        print(3,4)
    for i in range(2,len(a)):
        if a[i]!=-1:
            for j in range(i+1,len(a)):
                if a[j]!=-1:
                    s=a[j]+a[i]
                    if s%b==0:
                        print(i+1,j+1)
                        a[j]=-1
                        break


t=int(input())
for _ in range(t):
    n=int(input())
    a=list(map(int,input().split()))
    a.sort()
    b=a[0]+a[1]
    if n==2:
        print(3,4)
    for i in range(2,len(a)):
        for j in range(i+1,len(a)):
            if a[j]!=-1:
                s=a[j]+a[i]
                if s%b==0:
                    print(i+1,j+1)
                    a[j]=-1
                    break


t=int(input())
for _ in range(t):
    n=int(input())
    list1=[int(a) for a in input().split()]
    even=0
    odd=0
    list2=[]
    list3=[]
    for x in range(2*n):
        if list1[x]%2==0:
            list2.append(list1[x])
        else:
            list3.append(list1[x])
    if len(list2)%2==0:
        list2.pop()
        list2.pop()
    else:
        list2.pop()
        list3.pop()
    for x in range(len(list2)):
        print(list1.index(list2[x]),list1.index(list2[x+1]))
    for x in range(len(list3)):
        print(list1.index(list3[x]),list1.index(list3[x+1]))


t=int(input())
for _ in range(t):
    n=int(input())
    list1=[int(a) for a in input().split()]
    even=0
    odd=0
    list2=[]
    list3=[]
    for x in range(2*n):
        if list1[x]%2==0:
            list2.append(list1[x])
        else:
            list3.append(list1[x])
    if len(list2)%2==0:
        list2.pop()
        list2.pop()
    else:
        list2.pop()
        list3.pop()
    for x in range(0,len(list2),2):
        print(list1.index(list2[x])+1,list1.index(list2[x+1])+1)
    for x in range(0,len(list3),2):
        print(list1.index(list3[x])+1,list1.index(list3[x+1])+1)


t=int(input())
for _ in range(t):
    n=int(input())
    list1=[int(a) for a in input().split()]
    even=0
    odd=0
    list2=[]
    list3=[]
    for x in range(2*n):
        if list1[x]%2==0:
            list2.append(list1[x])
        else:
            list3.append(list1[x])
    if len(list2)%2==0:
        list2.pop()
        list2.pop()
    else:
        list2.pop()
        list3.pop()
    for x in range(0,len(list2),2):
        print(list1.index(list2[x])+1,list1.index(list2[x+1])+1)
        list1[list1.index(list2[x])]=-1
        list1[list1.index(list2[x+1])]=-1
    for x in range(0,len(list3),2):
        print(list1.index(list3[x])+1,list1.index(list3[x+1])+1)
        list1[list1.index(list3[x])]=-1
        list1[list1.index(list3[x+1])]=-1


t=int(input())
for _ in range(t):
    n=int(input())
    list1=[int(a) for a in input().split()]
    even=0
    odd=0
    list2=[]
    list3=[]
    for x in range(2*n):
        if list1[x]%2==0:
            list2.append(list1[x])
        else:
            list3.append(list1[x])
    if len(list2)%2==0:
        if list2!=[]:
            list2.pop()
            list2.pop()
        else:
            list3.pop()
            list3.pop()
    else:
        list2.pop()
        list3.pop()
    for x in range(0,len(list2),2):
        print(list1.index(list2[x])+1,list1.index(list2[x+1])+1)
        list1[list1.index(list2[x])]=-1
        list1[list1.index(list2[x+1])]=-1
    for x in range(0,len(list3),2):
        print(list1.index(list3[x])+1,list1.index(list3[x+1])+1)
        list1[list1.index(list3[x])]=-1
        list1[list1.index(list3[x+1])]=-1


import sys, os, io
def rs(): return sys.stdin.readline().rstrip()
def ri(): return int(sys.stdin.readline())
def ria(): return list(map(int, sys.stdin.readline().split()))
def ws(s): sys.stdout.write(s + '\n')
def wi(n): sys.stdout.write(str(n) + '\n')
def wia(a): sys.stdout.write(' '.join([str(x) for x in a]) + '\n')
import math as mt
from collections import deque

def main():
  tc=ri()
  for _ in range(tc):
    n=ri()
    l=ria()
    e=[]
    o=[]
    for i in range(2*n):
      if l[i]%2==0:
        e.append(i+1)
      else:
        o.append(i+1)
    #print(*e)
    #print(*o)
    z=0
    flag=1
    x=len(e)
    y=len(o)
    if x%2:
      x-=1
    if y%2:
      y-=1
    for i in range(0,x,2):
      print(e[i],e[i+1])
      z+=1
      if z==n-1:
        flag=0
        break
    if flag:
      for i in range(0,y,2):
        print(o[i],o[i+1])
        z+=1
        if z==n-1:
          break

class FastReader(io.IOBase):
    newlines = 0

    def __init__(self, fd, chunk_size=1024 * 8):
        self._fd = fd
        self._chunk_size = chunk_size
        self.buffer = io.BytesIO()

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, self._chunk_size))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self, size=-1):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, self._chunk_size if size == -1 else size))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

class FastWriter(io.IOBase):

    def __init__(self, fd):
        self._fd = fd
        self.buffer = io.BytesIO()
        self.write = self.buffer.write

    def flush(self):
        os.write(self._fd, self.buffer.getvalue())
        self.buffer.truncate(0), self.buffer.seek(0)

class FastStdin(io.IOBase):
    def __init__(self, fd=0):
        self.buffer = FastReader(fd)
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")

class FastStdout(io.IOBase):
    def __init__(self, fd=1):
        self.buffer = FastWriter(fd)
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.flush = self.buffer.flush

if __name__ == '__main__':
    #sys.stdin = FastStdin()
    #sys.stdout = FastStdout()
    main()


import sys, os, io
def rs(): return sys.stdin.readline().rstrip()
def ri(): return int(sys.stdin.readline())
def ria(): return list(map(int, sys.stdin.readline().split()))
def ws(s): sys.stdout.write(s + '\n')
def wi(n): sys.stdout.write(str(n) + '\n')
def wia(a): sys.stdout.write(' '.join([str(x) for x in a]) + '\n')
import math as mt
from collections import deque

def main():
  tc=ri()
  for _ in range(tc):
    n=ri()
    l=ria()
    e=[]
    o=[]
    for i in range(2*n):
      if l[i]%2==0:
        e.append(i+1)
      else:
        o.append(i+1)
    #print(*e)
    #print(*o)
    z=0
    flag=1
    x=len(e)
    y=len(o)
    if x%2:
      x-=1
    if y%2:
      y-=1
    for i in range(0,x,2):
      print(e[i],e[i+1])
      z+=1
      if z==n-1:
        flag=0
        break
    if flag:
      for i in range(0,y,2):
        print(o[i],o[i+1])
        z+=1
        if z==n-1:
          break

'''class FastReader(io.IOBase):
    newlines = 0

    def __init__(self, fd, chunk_size=1024 * 8):
        self._fd = fd
        self._chunk_size = chunk_size
        self.buffer = io.BytesIO()

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, self._chunk_size))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self, size=-1):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, self._chunk_size if size == -1 else size))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

class FastWriter(io.IOBase):

    def __init__(self, fd):
        self._fd = fd
        self.buffer = io.BytesIO()
        self.write = self.buffer.write

    def flush(self):
        os.write(self._fd, self.buffer.getvalue())
        self.buffer.truncate(0), self.buffer.seek(0)

class FastStdin(io.IOBase):
    def __init__(self, fd=0):
        self.buffer = FastReader(fd)
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")

class FastStdout(io.IOBase):
    def __init__(self, fd=1):
        self.buffer = FastWriter(fd)
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.flush = self.buffer.flush'''

if __name__ == '__main__':
    '''sys.stdin = FastStdin()
    sys.stdout = FastStdout()'''
    main()


import sys, os, io
def rs(): return sys.stdin.readline().rstrip()
def ri(): return int(sys.stdin.readline())
def ria(): return list(map(int, sys.stdin.readline().split()))
def ws(s): sys.stdout.write(s + '\n')
def wi(n): sys.stdout.write(str(n) + '\n')
def wia(a): sys.stdout.write(' '.join([str(x) for x in a]) + '\n')
import math as mt
from collections import deque

def main():
  tc=ri()
  for _ in range(tc):
    n=ri()
    l=ria()
    e=[]
    o=[]
    for i in range(2*n):
      if l[i]%2==0:
        e.append(i+1)
      else:
        o.append(i+1)
    #print(*e)
    #print(*o)
    z=0
    flag=1
    x=len(e)
    y=len(o)
    if x%2:
      x-=1
    if y%2:
      y-=1
    for i in range(0,x,2):
      print(e[i],e[i+1])
      z+=1
      if z==n-1:
        flag=0
        break
    if flag:
      for i in range(0,y,2):
        print(o[i],o[i+1])
        z+=1
        if z==n-1:
          break

class FastReader(io.IOBase):
    newlines = 0

    def __init__(self, fd, chunk_size=1024 * 8):
        self._fd = fd
        self._chunk_size = chunk_size
        self.buffer = io.BytesIO()

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, self._chunk_size))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self, size=-1):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, self._chunk_size if size == -1 else size))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

class FastWriter(io.IOBase):

    def __init__(self, fd):
        self._fd = fd
        self.buffer = io.BytesIO()
        self.write = self.buffer.write

    def flush(self):
        os.write(self._fd, self.buffer.getvalue())
        self.buffer.truncate(0), self.buffer.seek(0)

class FastStdin(io.IOBase):
    def __init__(self, fd=0):
        self.buffer = FastReader(fd)
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")

class FastStdout(io.IOBase):
    def __init__(self, fd=1):
        self.buffer = FastWriter(fd)
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.flush = self.buffer.flush

if __name__ == '__main__':
    sys.stdin = FastStdin()
    sys.stdout = FastStdout()
    main()


def gcd(array):
    array_odd=[]
    array_even=[]

    n_odd=0
    for y,x in enumerate(array):
        if x%2!=0:
            n_odd+=1
            array_odd.append(y)
        else:
            array_even.append(y)
    if n_odd%2==0:
        array_even.pop()
        array_even.pop()
        i=0
        j=0
        while i<(len(array_even)):
            print(array_even[i],array_even[i+1])
            i=i+2
        while j<len(array_odd):
            print(array_odd[j],array_odd[j+1])
            j+=2
    if n_odd%2!=0:
        array_odd.pop()
        array_even.pop()
        i=0
        j=0
        while i<(len(array_even)):
            print(array_even[i],array_even[i+1])
            i=i+2
        while j<len(array_odd):
            print(array_odd[j],array_odd[j+1])
            j+=2
t=int(input())
array=[]
for i in range(t):
    a=int(input())
    b=list(map(int,input().split(" ")))
    array.append([a,b])
for x in array:
    (gcd(x[1]))


def gcd(array):
    array_odd=[]
    array_even=[]

    n_odd=0
    for x in array:
        if x%2!=0:
            n_odd+=1
            array_odd.append(x)
        else:
            array_even.append(x)
    if n_odd%2==0:
        array_even.pop()
        array_even.pop()
        i=0
        j=0
        while i<(len(array_even)):
            print(array_even[i],array_even[i+1])
            i=i+2
        while j<len(array_odd):
            print(array_odd[j],array_odd[j+1])
            j+=2
    if n_odd%2!=0:
        array_odd.pop()
        array_even.pop()
        i=0
        j=0
        while i<(len(array_even)):
            print(array_even[i],array_even[i+1])
            i=i+2
        while j<len(array_odd):
            print(array_odd[j],array_odd[j+1])
            j+=2
t=int(input())
array=[]
for i in range(t):
    a=int(input())
    b=list(map(int,input().split(" ")))
    array.append([a,b])
for x in array:
    (gcd(x[1]))


def gcd(array):
    array_odd=[]
    array_even=[]

    n_odd=0
    for y,x in enumerate(array):
        if x%2!=0:
            n_odd+=1
            array_odd.append(x)
        else:
            array_even.append(x)
    if n_odd%2==0:
        array_even.pop()
        array_even.pop()
        i=0
        j=0
        while i<(len(array_even)):
            print(array_even[i],array_even[i+1])
            i=i+2
        while j<len(array_odd):
            print(array_odd[j],array_odd[j+1])
            j+=2
    if n_odd%2!=0:
        array_odd.pop()
        array_even.pop()
        i=0
        j=0
        while i<(len(array_even)):
            print(array_even[i],array_even[i+1])
            i=i+2
        while j<len(array_odd):
            print(array_odd[j],array_odd[j+1])
            j+=2
t=int(input())
array=[]
for i in range(t):
    a=int(input())
    b=list(map(int,input().split(" ")))
    array.append([a,b])
for x in array:
    (gcd(x[1]))


def gcd(array):
    array_odd=[]
    array_even=[]

    n_odd=0
    for y,x in enumerate(array):
        if x%2!=0:
            n_odd+=1
            array_odd.append(y+1)
        else:
            array_even.append(y+1)
    if n_odd%2==0:
        if len(array_even)!=0:
            array_even.pop()
            array_even.pop()
        else:
            array_odd.pop()
            array_odd.pop()
        i=0
        j=0
        while i<(len(array_even)):
            print(array_even[i],array_even[i+1])
            i=i+2
        while j<len(array_odd):
            print(array_odd[j],array_odd[j+1])
            j+=2
    if n_odd%2!=0:
        array_odd.pop()
        array_even.pop()
        i=0
        j=0
        while i<(len(array_even)):
            print(array_even[i],array_even[i+1])
            i=i+2
        while j<len(array_odd):
            print(array_odd[j],array_odd[j+1])
            j+=2
t=int(input())
array=[]
for i in range(t):
    a=int(input())
    b=list(map(int,input().split(" ")))
    array.append([a,b])
for x in array:
    (gcd(x[1]))


def gcd(array):
    array_odd=[]
    array_even=[]

    n_odd=0
    for y,x in enumerate(array):
        if x%2!=0:
            n_odd+=1
            array_odd.append(y+1)
        else:
            array_even.append(y+1)
    if n_odd%2==0:
        array_even.pop()
        array_even.pop()
        i=0
        j=0
        while i<(len(array_even)):
            print(array_even[i],array_even[i+1])
            i=i+2
        while j<len(array_odd):
            print(array_odd[j],array_odd[j+1])
            j+=2
    if n_odd%2!=0:
        array_odd.pop()
        array_even.pop()
        i=0
        j=0
        while i<(len(array_even)):
            print(array_even[i],array_even[i+1])
            i=i+2
        while j<len(array_odd):
            print(array_odd[j],array_odd[j+1])
            j+=2
t=int(input())
array=[]
for i in range(t):
    a=int(input())
    b=list(map(int,input().split(" ")))
    array.append([a,b])
for x in array:
    (gcd(x[1]))


from sys import stdin, stdout
for i in range(int(stdin.readline())):
    n, temp = int(stdin.readline()), 0
    a = [int(num) for num in stdin.readline().split()]
    e, o = [], []
    for j in range(len(a)) :
        if a[j] % 2 == 0 :
            e.append(j+1)
        else :
            o.append(j+1)
    while temp < n - 1:
        if len(e) > 1:
            print(e.pop(0), e.pop(0))
            temp += 1
        if len(o) > 1:
            print(o.pop(0), o.pop(1))
            temp += 1


from sys import stdin, stdout
for i in range(int(stdin.readline())) :
    n, temp = int(stdin.readline()), 0
    a = [int(num) for num in stdin.readline().split()]
    e, o = list(filter(lambda n : n%2 == 0, a)), list(filter(lambda n : n%2 != 0, a))
    while temp < n-1 :
        if len(e) > 1 :
            print(e.pop(0), e.pop(0))
            temp += 1
        if len(o) > 1 :
            print(o.pop(0), o.pop(0))
            temp += 1


from sys import stdin, stdout
for i in range(int(stdin.readline())):
    n, temp = int(stdin.readline()), 0
    a = [int(num) for num in stdin.readline().split()]
    e, o = [], []
    for j in range(len(a)) :
        if a[j] % 2 == 0 :
            e.append(j+1)
        else :
            o.append(j+1)
    while temp < n - 1:
        if len(e) > 1:
            print(e.pop(0), e.pop(0))
            temp += 1
        if len(o) > 1 and temp < n-1:
            print(o.pop(0), o.pop(0))
            temp += 1


from sys import stdin, stdout
for i in range(int(stdin.readline())) :
    n, temp = int(stdin.readline()), 0
    a = [int(num) for num in stdin.readline().split()]
    e, o = list(filter(lambda n : n%2 == 0, a)), list(filter(lambda n : n%2 != 0, a))
    while temp < n-1 :
        if len(e) > 1 :
            print(a.index(e.pop(0))+1, a.index(e.pop(0))+1)
            temp += 1
        if len(o) > 1 :
            print(a.index(o.pop(0))+1, a.index(o.pop(0))+1)
            temp += 1


from sys import stdin, stdout
for i in range(int(stdin.readline())):
    n, temp = int(stdin.readline()), 0
    a = [int(num) for num in stdin.readline().split()]
    e, o = [], []
    for j in range(len(a)) :
        if a[j] % 2 == 0 :
            e.append(j+1)
        else :
            o.append(j+1)
    while temp < n - 1:
        if len(e) > 1:
            print(e.pop(0), e.pop(0))
            temp += 1
        if len(o) > 1:
            print(o.pop(0), o.pop(0))
            temp += 1


from sys import stdin, stdout
for i in range(int(stdin.readline())):
    n, temp = int(stdin.readline()), 0
    a = [int(num) for num in stdin.readline().split()]
    e, o = [], []
    for j in a :
        if j % 2 == 0 :
            e.append(a.index(j)+1)
        else :
            o.append(a.index(j)+1)
    while temp < n - 1:
        if len(e) > 1:
            print(e.pop(0), e.pop(0))
            temp += 1
        if len(o) > 1:
            print(o.pop(0), o.pop(1))
            temp += 1


from sys import stdin, stdout
for i in range(int(stdin.readline())):
    n, temp = int(stdin.readline()), 0
    a = [int(num) for num in stdin.readline().split()]
    e, o = [], []
    for j in range(len(a)) :
        if a[j] % 2 == 0 :
            e.append(j+1)
        else :
            o.append(j+1)
    print(n, e, o)
    while temp < n - 1:
        if len(e) > 1:
            print(e.pop(0), e.pop(0))
            temp += 1
        if len(o) > 1 and temp < n-1:
            print(o.pop(0), o.pop(0))
            temp += 1


t=int(input())
for ii in range(t):
    n=int(input())
    a=list(map(int,input().split()))
    e=[]
    o=[]
    for i in range(len(a)):
        if a[i]%2==0:
            e.append(i+1)
        else:
            o.append(i+1)

    if len(o)%2!=0:
        o=o[1:]
        e=e[1:]
    elif len(e)>=2:
        e=e[2:]
    else:
        o=o[2:]
    k=0
    kk=0

    while(k<len(o)-1):
        print(o[k],end=" ")
        print(o[k+1])
        k=k+2
    while(kk<len(e)-1):
        print(e[kk],end=" ")
        print(e[kk+1])
        kk=kk+2


t=int(input())
for ii in range(t):
    n=int(input())
    a=list(map(int,input().split()))
    e=[]
    o=[]
    for i in range(len(a)):
        if a[i]%2==0:
            e.append(i+1)
        else:
            o.append(i+1)
    if len(o)%2!=0:
        o=o[1:]
        e=e[1:]
    else:
        o=o[2:]
    k=0
    kk=0
    #print(o)
    #print(e)
    while(k<len(o)-1):
        print(o[k],end=" ")
        print(o[k+1])
        k=k+2
    while(kk<len(e)-1):
        print(e[kk],end=" ")
        print(e[kk+1])
        kk=kk+2


t=int(input())
for ii in range(t):
    n=int(input())
    a=list(map(int,input().split()))
    e=[]
    o=[]
    for i in range(len(a)):
        if a[i]%2==0:
            e.append(i+1)
        else:
            o.append(i+1)
    if len(o)%2!=0:
        o=o[1:]
        e=e[1:]
    else:
        o=o[2:]
    k=0
    kk=0
    #print(o)
    #print(e)
    while(k<len(o)-1):
        print(o[k],end=" ")
        print(o[k+1])
        k=k+2
    while(kk<len(o)-1):
        print(e[kk],end=" ")
        print(e[kk+1])
        kk=kk+2


t = int(input())

for i in range(t) :
    n = int(input())
    a = list(map(int,input().strip().split()))[:2*n]
    odd = []
    even = []
    odd.sort()
    even.sort()
    for j in range(2*n) :
        if a[j] % 2 == 0 :
            even.append(a[j])
        else :
            odd.append(a[j])
    if len(even) >= 2 :
        even.pop(0)
    else :
        odd.pop(0)
    if len(even) % 2 == 0 :
        odd.pop(0)
    else :
        even.pop(0)

    print(*odd,*even)

    # 1 2 3 4 5 6
    # 1 3 5
    # 2 4 6


t = int(input())

for i in range(t) :
    n = int(input())
    a = list(map(int,input().strip().split()))[:2*n]
    odd = []
    even = []
    odd.sort()
    even.sort()
    for j in range(2*n) :
        if a[j] % 2 == 0 :
            even.append(a[j])
        else :
            odd.append(a[j])
    for j in range(n-1) :
        if len(even) > 1 :
            print(even.pop(0),even.pop(0))
        else :
            print(odd.pop(0),odd.pop(0))


t = int(input())

for i in range(t) :
    n = int(input())
    a = list(map(int,input().strip().split()))[:2*n]
    odd = []
    even = []
    odd.sort()
    even.sort()
    for j in range(2*n) :
        if a[j] % 2 == 0 :
            even.append(j+1)
        else :
            odd.append(j+1)
    for j in range(n-1) :
        if len(even) > 1 :
            print(even.pop(0),even.pop(0))
        else :
            print(odd.pop(0),odd.pop(0))


t=int(input())
for i in range(t):
    n=int(input())
    x = list(map(int, input().split()))
    len1=len(x);
    #print(len1)
    #my_dict = dict()
    y=[];
    y1=[];
    k=int(0)
    k1=int(0)
    for j in range(len1):
        if x[j]%2==0:
            # key = input("Enter the key: ")
            #value = input("Enter the value: ")
            y.insert(k,j);
            k=k+1;
            #print(y)
        else:
            y1.insert(k, j);
            k1 = k1+ 1;
            #print(y1)
    len2=len(y);
    len3=len(y1);
    if len3==0:
        l1=(len2/2)-1;
    else:
        l1 = (len2 / 2)
    if len2==0:
        l2=(len3/2)-1;
    else:
        l2=len3/2;
    len4=min(len2,len3);
    #print(len4)
    cnt=int(0);
    cnt1=int(0);
    m=int(0);
    p=int(0);
    #if(len4==len2):
    if (len2>=2):
        #print("N is:",n)
        for l in range(int(l1)):
            print(y[m] + 1, y[m+1] + 1)
            m=m+2;
            cnt=cnt+1;
        if (cnt<n-1):
            for l in range((n-1)-int(l1)):
                print(y1[p] + 1, y1[p+1] + 1)
                p=p+2;

        # elif(len2 % 2 != 0 and len2>=2):
        #     for l in range(int(len2/2)):
        #         print(y[l] + 1, y[l] + 1)

    elif(len3>=2):
        #print("2")
        #print("N is:", n)
        for l in range(int(l2)):
            print(y1[m] + 1, y1[m+1] + 1)
            m=m+2;
            cnt1=cnt1+1;
        if (cnt1< n - 1):
            for l in range((n-1)-int(l2)):
                print(y[p] + 1, y[p+1] + 1)
                p=p+2;
    x.clear();
    y.clear();
    y1.clear();


#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<queue>
#include<vector>
#include<cmath>
#include<map>
#include<set>
#include<deque>
using namespace std;
typedef long long ll;
pair<ll,ll> a[444444];
ll n,m,x,y,ans1,ans2;
int main()
{
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>a[i].first ;
		a[i].second =-1;
	}
	cin>>m;
	for(int i=0;i<m;i++)
	{
		cin>>a[i+n].first ;
		a[i+n].second =1;
	}
	x=n*3;
	y=m*3;
	ans1=x;
	ans2=y;
	sort(a,a+n+m);
	for(int i=0;i<n+m;i++)
	{
		if(a[i].second ==-1)
		x--;
		else
		y--;
		if(x-y>ans1-ans2)
		{
			ans1=x;
			ans2=y;
		}
	}
	cout<<ans1<<":"<<ans2;
	return 0;
}


#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<queue>
#include<vector>
#include<cmath>
#include<map>
#include<set>
#include<deque>
using namespace std;
typedef long long ll;
pair<ll,ll> a[55555];
ll n,m,x,y,ans1,ans2;
int main()
{
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>a[i].first ;
		a[i].second =-1;
	}
	cin>>m;
	for(int i=0;i<m;i++)
	{
		cin>>a[i+n].first ;
		a[i+n].second =1;
	}
	x=n*3;
	y=m*3;
	ans1=x;
	ans2=y;
	for(int i=0;i<n+m;i++)
	{
		if(a[i].second ==-1)
		x--;
		else
		y--;
		if(abs(x-y)>abs(ans1-ans2))
		{
			ans1=x;
			ans2=y;
		}
	}
	cout<<ans1<<":"<<ans2;
	return 0;
}


#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<sstream>
using namespace std;
int a[222222],b[222222];
int save[222222],savea[222222],saveb[222222];
int main()
{
	int n,m,check1=0,check2=0,h=0,cnt=0;
	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);
	for(int i=0;i<max(a[n-1],b[m-1]);i++)
	{
		for(int j=0;j<n;j++)
		{
			if(a[j]>i)
			{
				check1+=3;
			}
			else
			{
				check1+=2;
			}
		}
		for(int j=0;j<m;j++)
		{
			if(b[j]>i)
			{
				check2+=3;
			}
			else
			{
				check2+=2;
			}
		}
		save[cnt]=check1-check2;
		savea[cnt]=check1;
		saveb[cnt]=check2;
		cnt++;
		check1=0;
		check2=0;
	}
	sort(save,save+cnt);
	reverse(save,save+cnt);
	for(int i=0;i<cnt;i++)
	{
		for(int j=0;j<cnt;j++)
		{
			if(savea[i]-saveb[j]==save[0])
			{
				cout<<savea[i]<<":"<<saveb[j];
				h=1;
				break;
			}
		}
		if(h==1)
		{
			break;
		}
	}
	return 0;
}


#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<sstream>
using namespace std;
pair<int,int> a[444444];
int main()
{
	int n,m;
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>a[i].first;
		a[i].second=-1;
	}
	cin>>m;
	for(int i=0;i<m;i++)
	{
		cin>>a[i+n].first;
		a[i+n].second=1;
	}
	sort(a,a+n+m);
	int x=n*3,y=m*3,mx=x,my=y;
	for(int i=0;i<n+m;i++)
	{
		if(a[i].second==1)
		{
			y--;
		}
		else
		{
			x--;
		}
		if(x-y>mx-my)
		{
			mx=x;
			my=y;
		}
	 }
	 cout<<mx<<":"<<my;
	return 0;
}


#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<queue>
#include<vector>
#include<cmath>
#include<map>
#include<set>
#include<deque>
using namespace std;
typedef long long ll;
pair<ll,ll> a[55555];
ll n,m,x,y,ans1,ans2;
int main()
{
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>a[i].first ;
		a[i].second =-1;
	}
	cin>>m;
	for(int i=0;i<m;i++)
	{
		cin>>a[i+n].first ;
		a[i+n].second =1;
	}
	x=n*3;
	y=m*3;
	ans1=x;
	ans2=y;
	sort(a,a+n+m);
	for(int i=0;i<n+m;i++)
	{
		if(a[i].second ==-1)
		x--;
		else
		y--;
		if(x-y>ans1-ans2)
		{
			ans1=x;
			ans2=y;
		}
	}
	cout<<ans1<<":"<<ans2;
	return 0;
}


#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<queue>
#include<vector>
#include<cmath>
#include<map>
#include<set>
#include<deque>
using namespace std;
typedef long long ll;
pair<ll,ll> a[55555];
ll n,m,x,y,ans1,ans2;
int main()
{
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>a[i].first ;
		a[i].second =1;
	}
	cin>>m;
	for(int i=0;i<m;i++)
	{
		cin>>a[i+n].first ;
		a[i+n].second =-1;
	}
	x=n*3;
	y=m*3;
	ans1=x;
	ans2=y;
	for(int i=0;i<n+m;i++)
	{
		if(a[i].second ==1)
		x--;
		else
		y--;
		if(x-y>ans1-ans2)
		{
			ans1=x;
			ans2=y;
		}
	}
	cout<<ans1<<":"<<ans2;
	return 0;
}


#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<queue>
#include<vector>
#include<cmath>
#include<map>
#include<set>
#include<deque>
using namespace std;
typedef long long ll;
pair<ll,ll> a[55555];
ll n,m,x,y,ans1,ans2;
int main()
{
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>a[i].first ;
		a[i].second =-1;
	}
	cin>>m;
	for(int i=0;i<m;i++)
	{
		cin>>a[i+n].first ;
		a[i+n].second =1;
	}
	x=n*3;
	y=m*3;
	ans1=x;
	ans2=y;
	sort(a,a+n+m);
	for(int i=0;i<n+m;i++)
	{
		if(a[i].second ==-1)
		x--;
		else
		y--;
		if(abs(x-y)>abs(ans1-ans2))
		{
			ans1=x;
			ans2=y;
		}
	}
	cout<<ans1<<":"<<ans2;
	return 0;
}


/**
 * Created by Anna on 25.12.2014.
 */

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

public class TaskC {
    StringTokenizer st;
    BufferedReader in;
    PrintWriter out;

    public static void main(String[] args) throws NumberFormatException,
            IOException {
        TaskC solver = new TaskC();
        solver.open();
        solver.solve();
        solver.close();
    }

    public void open() throws IOException {
        in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
//        in = new BufferedReader(new FileReader(new File("reachability.in")));
//        out = new PrintWriter(new FileWriter(new File("reachability.out")));
    }

    public String nextToken() throws IOException {
        while (st == null || !st.hasMoreTokens()) {
            String line = in.readLine();
            if (line == null)
                return null;
            st = new StringTokenizer(line, " \t\n\r.");
        }
        return st.nextToken();
    }

    public int nextInt() throws NumberFormatException, IOException {
        return Integer.parseInt(nextToken());
    }

    public long nextLong() throws NumberFormatException, IOException {
        return Long.parseLong(nextToken());
    }

    public double nextDouble() throws NumberFormatException, IOException {
        return Double.parseDouble(nextToken());
    }

    public void solve() throws NumberFormatException, IOException {
        int firstCnt = nextInt();
        int[] first = new int[firstCnt];
        for (int i = 0; i < firstCnt; i++) {
            first[i] = nextInt();
        }
        Arrays.sort(first);

        int secondCnt = nextInt();
        int[] second = new int[secondCnt];
        for (int i = 0; i < secondCnt; i++) {
            second[i] = nextInt();
        }
        Arrays.sort(second);

        int maxD;
        int maxFirst, maxSecond;

        maxD = first[0] - 1;
        maxFirst = firstCnt * 3;

        int left = 0;
        int right = secondCnt - 1;
        while (left - right > 2) {
            int middle = (left + right) / 2;
            if (second[middle] <= maxD) left = middle;
            else right = middle;
        }
        while (left < secondCnt && second[left] <= maxD) left++;
        maxSecond = 2 * left + 3 * (secondCnt - left);

        for (int i = 0; i < firstCnt; i++) {
            int curD = first[i];
            int curFirst = 2 * (i + 1) + 3 * (firstCnt - i - 1);

            left = 0;
            right = secondCnt - 1;
            while (left - right > 2) {
                int middle = (left + right) / 2;
                if (second[middle] <= curD) left = middle;
                else right = middle;
            }
            while (left < secondCnt && second[left] <= curD) left++;
            int curSecond = 2 * left + 3 * (secondCnt - left);

            if (curFirst - curSecond > maxFirst - maxSecond) {
                maxD = curD;
                maxFirst = curFirst;
                maxSecond = curSecond;
            }
        }

        for (int i = 0; i < secondCnt; i++) {
            int curD = second[i];
            int curSecond = 2 * (i + 1) + 3 * (secondCnt - i - 1);

            left = 0;
            right = firstCnt - 1;
            while (left - right > 2) {
                int middle = (left + right) / 2;
                if (first[middle] <= curD) left = middle;
                else right = middle;
            }
            while (left < firstCnt && first[left] <= curD) left++;
            int curFirst = 2 * left + 3 * (firstCnt - left);

            if (curFirst - curSecond > maxFirst - maxSecond) {
                maxD = curD;
                maxSecond = curSecond;
                maxFirst = curFirst;
            }
        }

        out.println(maxFirst + ":" + maxSecond);

    }

    public void close() {
        out.flush();
        out.close();
    }
}


/**
 * Created by Anna on 25.12.2014.
 */

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;

public class TaskCFine {
    StringTokenizer st;
    BufferedReader in;
    PrintWriter out;

    public static void main(String[] args) throws NumberFormatException,
            IOException {
        TaskCFine solver = new TaskCFine();
        solver.open();
        solver.solve();
        solver.close();
    }

    public void open() throws IOException {
        in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
//        in = new BufferedReader(new FileReader(new File("reachability.in")));
//        out = new PrintWriter(new FileWriter(new File("reachability.out")));
    }

    public String nextToken() throws IOException {
        while (st == null || !st.hasMoreTokens()) {
            String line = in.readLine();
            if (line == null)
                return null;
            st = new StringTokenizer(line, " \t\n\r.");
        }
        return st.nextToken();
    }

    public int nextInt() throws NumberFormatException, IOException {
        return Integer.parseInt(nextToken());
    }

    public long nextLong() throws NumberFormatException, IOException {
        return Long.parseLong(nextToken());
    }

    public double nextDouble() throws NumberFormatException, IOException {
        return Double.parseDouble(nextToken());
    }

//
//    // Implementing Fisher–Yates shuffle
//    static void shuffleArray(int[] ar)
//    {
//        Random rnd = new Random();
//        for (int i = ar.length - 1; i > 0; i--)
//        {
//            int index = rnd.nextInt(i + 1);
//            // Simple swap
//            int a = ar[index];
//            ar[index] = ar[i];
//            ar[i] = a;
//        }
//    }

    class Upthrow implements Comparable<Upthrow> {
        int team;
        int distance;

        public Upthrow(int team, int distance) {
            this.team = team;
            this.distance = distance;
        }

        @Override
        public int compareTo(Upthrow o) {
            if (distance > o.distance) return 1;
            if (distance < o.distance) return -1;
            return team - o.team;
        }

        @Override
        public boolean equals(Object o) {
            if (this == o) return true;
            if (o == null || getClass() != o.getClass()) return false;

            Upthrow upthrow = (Upthrow) o;

            if (distance != upthrow.distance) return false;
            if (team != upthrow.team) return false;

            return true;
        }

        @Override
        public int hashCode() {
            int result = team;
            result = 31 * result + distance;
            return result;
        }
    }

    public void solve() throws NumberFormatException, IOException {
        int firstCnt = nextInt();
        ArrayList<Upthrow> upthrows = new ArrayList<Upthrow>();
        for (int i = 0; i < firstCnt; i++) {
            upthrows.add(new Upthrow(1, nextInt()));
        }

        int secondCnt = nextInt();
        for (int i = 0; i < secondCnt; i++) {
            upthrows.add(new Upthrow(2, nextInt()));
        }

        Collections.sort(upthrows);

        int maxD;
        int maxFirst, maxSecond;

        maxD = upthrows.get(0).distance - 1;
        maxFirst = firstCnt * 3;
        maxSecond = secondCnt * 3;

        int cntTwoFirst = 0, cntToSecond = 0;
        for (int i = 0; i < upthrows.size(); ) {
            int curD = upthrows.get(i).distance;
            int ind = i;
            while (ind < upthrows.size() && upthrows.get(i).distance == upthrows.get(ind).distance) {
                if (upthrows.get(ind).team == 1) cntTwoFirst++;
                else cntToSecond++;
                ind++;
            }
            int curFirst = 2 * cntTwoFirst + 3 * (firstCnt - cntTwoFirst);
            int curSecond = 2 * cntToSecond + 3 * (secondCnt - cntToSecond);

            if (curFirst - curSecond > maxFirst - maxSecond) {
                maxD = curD;
                maxFirst = curFirst;
                maxSecond = curSecond;
            }

            i = ind;
        }

        out.println(maxFirst + ":" + maxSecond);

    }

    public void close() {
        out.flush();
        out.close();
    }
}


import java.util.Arrays;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Writer;
import java.io.FileReader;
import java.io.IOException;
import java.util.StringTokenizer;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author Agostinho Junior (junior94)
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		OutputWriter out = new OutputWriter(outputStream);
		TaskC solver = new TaskC();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskC {
	public void solve(int testNumber, InputReader in, OutputWriter out) {
		final int n = in.readInt();
		Integer[] a = new Integer[n];
		for (int i = 0; i < n; i++) {
			a[i] = in.readInt();
		}
		final int m = in.readInt();
		Integer[] b = new Integer[m];
		for (int i = 0; i < m; i++) {
			b[i] = in.readInt();
		}
		Arrays.sort(a);
		Arrays.sort(b);
		int[] first = new int[m + 1];
		for (int i = 0; i < m; i++) {
			if (i == 0 || b[i - 1] < b[i]) {
				first[i] = i;
			} else {
				first[i] = first[i - 1];
			}
		}
		first[m] = m;
		int bestA = 2 * n;
		int bestB = 2 * m;
		for (int two = 0; two < n; two++) {
			int aScore = 2 * two + 3 * (n - two);
			int bTwo = Arrays.binarySearch(b, a[two]);
			if (bTwo < 0) {
				bTwo = -(bTwo + 1);
			}
			bTwo = first[bTwo];
			int bScore;
			bScore = 2 * bTwo + 3 * (m - bTwo);
			if (aScore - bScore > bestA - bestB ||
					(aScore - bScore == bestA - bestB && aScore > bestA)) {
				bestA = aScore;
				bestB = bScore;
			}
		}
		out.printfln("%d:%d", bestA, bestB);
	}
}

class InputReader {
    private BufferedReader input;
    private StringTokenizer line = new StringTokenizer("");
	public InputReader(InputStream in) {
        input = new BufferedReader(new InputStreamReader(in));
    }
	public void fill() {
        try {
            if(!line.hasMoreTokens()) line = new StringTokenizer(input.readLine());
        } catch(IOException io) { io.printStackTrace(); System.exit(0);}
    }
	public int readInt() {
        fill();
        return Integer.parseInt(line.nextToken());
    }
}

class OutputWriter {
    private PrintWriter output;
	public OutputWriter(OutputStream out) {
        output = new PrintWriter(out);
    }
	public void printfln(String format, Object... o) {
        output.printf(format + "\n", o);
    }
	public void close() {
        output.close();
    }
}


import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.PriorityQueue;
import java.util.TreeSet;
public class Main {
	public static void main(String[] args) throws NumberFormatException, IOException{
		ContestScanner in = new ContestScanner();
		int n = in.nextInt();
		long[] a = new long[n];
		PriorityQueue<Long> qua = new PriorityQueue<Long>(1,new Reverse());
		long maxsub = 0;
		long nowsub = 0;
		long asum = 0;
		for(int i=0; i<n; i++){
			a[i] = in.nextLong();
			qua.add(a[i]);
			asum += 2;
		}
		int m = in.nextInt();
		long[] b = new long[m];
		PriorityQueue<Long> qub = new PriorityQueue<Long>(1,new Reverse());
		long bsum = 0;
		for(int i=0; i<m; i++){
			b[i] = in.nextLong();
			qub.add(b[i]);
			bsum += 2;
		}
//		int maxIdx = 0;
		nowsub = asum-bsum;
		maxsub = nowsub;
		long maxa = asum;
		long maxb = bsum;
		while(!qua.isEmpty() && !qub.isEmpty()){
			long at = qua.peek();
			long bt = qub.peek();
			if(at == bt){
				while(!qub.isEmpty() && qub.peek() == bt){
					bsum++;
					qub.poll();
				}
				while(!qua.isEmpty() && qua.peek() == at){
					asum++;
					qua.poll();
				}
			}else if(at < bt){
				while(!qub.isEmpty() && qub.peek() == bt){
					bsum++;
					qub.poll();
				}
			}else if(at > bt){
				while(!qua.isEmpty() && qua.peek() == at){
					asum++;
					qua.poll();
				}
			}
			nowsub = asum-bsum;
			if(nowsub >= maxsub){
				System.err.println(maxsub);
				maxsub = nowsub;
				maxa = asum;
				maxb = bsum;
			}
		}
		if(!qua.isEmpty()){
			asum += qua.size();
			nowsub = asum - bsum;
			if(nowsub >= maxsub){
				maxsub = nowsub;
				maxa = asum;
				maxb = bsum;
			}
		}
		System.out.println(maxa+":"+maxb);
	}

}

class MyComp implements Comparator<int[]>{
	public int compare(int[] a, int[] b) {
		return a[0] - b[0];
	}
}

class Reverse implements Comparator<Long>{
	public int compare(Long arg0, Long arg1) {
		return Long.compare(arg1, arg0);
	}
}

class Node{
	int id;
	List<Node> edge = new ArrayList<Node>();
	public Node(int id){
		this.id = id;
	}
	public void createEdge(Node node){
		edge.add(node);
	}
}

class NodeW{
	int id;
	List<NodeW> edge = new ArrayList<NodeW>();
	List<Integer> costList = new ArrayList<Integer>();
	public NodeW(int id) {
		this.id = id;
	}
	public void createEdge(NodeW node, int cost) {
		edge.add(node);
		costList.add(cost);
	}
}

class Range<T extends Comparable<T>> implements Comparable<Range<T>>{
	T start;
	T end;
	public Range(T start, T end){
		this.start = start;
		this.end = end;
	}
	public boolean inRange(T val){
		if(start.compareTo(val) <= 0 && end.compareTo(val) >= 0){
			return true;
		}
		return false;
	}

	public boolean isCommon(Range<T> range){
		if(inRange(range.start) || inRange(range.end) || range.inRange(start)){
			return true;
		}
		return false;
	}

	public Range<T> connect(Range<T> range){
		if(!isCommon(range)) return null;
		Range<T> res = new Range<T>(start.compareTo(range.start) <= 0 ? start : range.start,
				end.compareTo(range.end) >= 0 ? end : range.end);
		return res;
	}

	public boolean connectToThis(Range<T> range){
		if(!isCommon(range)) return false;
		start = start.compareTo(range.start) <= 0 ? start : range.start;
		end = end.compareTo(range.end) >= 0 ? end : range.end;
		return true;
	}
	@Override
	public int compareTo(Range<T> range) {
		int res = start.compareTo(range.start);
		if(res == 0) return end.compareTo(range.end);
		return res;
	}

	public String toString(){
		return "["+start+","+end+"]";
	}
}

class RangeSet<T extends Comparable<T>>{
	TreeSet<Range<T>> ranges = new TreeSet<Range<T>>();
	public void add(Range<T> range){
		Range<T> con = ranges.floor(range);
		if(con != null){
			if(con.connectToThis(range))
				range = con;
		}
		con = ranges.ceiling(range);
		while(con != null && range.connectToThis(con)){
			ranges.remove(con);
			con = ranges.ceiling(range);
		}
		ranges.add(range);
	}

	public String toString(){
		StringBuilder bld = new StringBuilder();
		for(Range<T> r: ranges){
			bld.append(r+"\n");
		}
		return bld.toString();
	}
}

class MyMath{
	public static long fact(long n){
		long res = 1;
		while(n > 0){
			res *= n--;
		}
		return res;
	}
	public static long[][] pascalT(int n){
		long[][] tri = new long[n][];
		for(int i=0; i<n; i++){
			tri[i] = new long[i+1];
			for(int j=0; j<i+1; j++){
				if(j == 0 || j == i){
					tri[i][j] = 1;
				}else{
					tri[i][j] = tri[i-1][j-1] + tri[i-1][j];
				}
			}
		}
		return tri;
	}
}

class ContestScanner{
	private BufferedReader reader;
	private String[] line;
	private int idx;
	public ContestScanner() throws FileNotFoundException{
		reader = new BufferedReader(new InputStreamReader(System.in));
	}

	public String nextToken() throws IOException{
		if(line == null || line.length <= idx){
			line = reader.readLine().trim().split(" ");
			idx = 0;
		}
		return line[idx++];
	}

	public long nextLong() throws IOException, NumberFormatException{
		return Long.parseLong(nextToken());
	}

	public int nextInt() throws NumberFormatException, IOException{
		return (int)nextLong();
	}

	public double nextDouble() throws NumberFormatException, IOException{
		return Double.parseDouble(nextToken());
	}
}


import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.PriorityQueue;
import java.util.TreeSet;
public class Main {
	public static void main(String[] args) throws NumberFormatException, IOException{
		ContestScanner in = new ContestScanner();
		int n = in.nextInt();
		long[] a = new long[n];
		PriorityQueue<Long> qua = new PriorityQueue<Long>();
		long maxsub = 0;
		long nowsub = 0;
		long asum = 0;
		for(int i=0; i<n; i++){
			a[i] = in.nextLong();
			qua.add(a[i]);
			asum += 2;
		}
		int m = in.nextInt();
		long[] b = new long[m];
		PriorityQueue<Long> qub = new PriorityQueue<Long>();
		long bsum = 0;
		for(int i=0; i<m; i++){
			b[i] = in.nextLong();
			qub.add(b[i]);
			bsum += 2;
		}
//		int maxIdx = 0;
		nowsub = asum-bsum;
		maxsub = nowsub;
		long maxa = asum;
		long maxb = bsum;
		while(!qua.isEmpty() && !qub.isEmpty()){
			long at = qua.peek();
			long bt = qub.peek();
			if(at == bt){
				asum++;
				bsum++;
				qua.poll();
				qub.poll();
			}else if(at < bt){
				asum++;
				qua.poll();
			}else if(at > bt){
				bsum++;
				qub.poll();
			}
			nowsub = asum-bsum;
			if(nowsub >= maxsub){
				System.err.println(maxsub);
				maxsub = nowsub;
				maxa = asum;
				maxb = bsum;
			}
		}
		if(!qua.isEmpty()){
			asum += qua.size();
			nowsub = asum - bsum;
			if(nowsub >= maxsub){
				maxsub = nowsub;
				maxa = asum;
				maxb = bsum;
			}
		}
		System.out.println(maxa+":"+maxb);
	}

}

class MyComp implements Comparator<int[]>{
	public int compare(int[] a, int[] b) {
		return a[0] - b[0];
	}
}

class Reverse implements Comparator<Integer>{
	public int compare(Integer arg0, Integer arg1) {
		return arg1 - arg0;
	}
}

class Node{
	int id;
	List<Node> edge = new ArrayList<Node>();
	public Node(int id){
		this.id = id;
	}
	public void createEdge(Node node){
		edge.add(node);
	}
}

class NodeW{
	int id;
	List<NodeW> edge = new ArrayList<NodeW>();
	List<Integer> costList = new ArrayList<Integer>();
	public NodeW(int id) {
		this.id = id;
	}
	public void createEdge(NodeW node, int cost) {
		edge.add(node);
		costList.add(cost);
	}
}

class Range<T extends Comparable<T>> implements Comparable<Range<T>>{
	T start;
	T end;
	public Range(T start, T end){
		this.start = start;
		this.end = end;
	}
	public boolean inRange(T val){
		if(start.compareTo(val) <= 0 && end.compareTo(val) >= 0){
			return true;
		}
		return false;
	}

	public boolean isCommon(Range<T> range){
		if(inRange(range.start) || inRange(range.end) || range.inRange(start)){
			return true;
		}
		return false;
	}

	public Range<T> connect(Range<T> range){
		if(!isCommon(range)) return null;
		Range<T> res = new Range<T>(start.compareTo(range.start) <= 0 ? start : range.start,
				end.compareTo(range.end) >= 0 ? end : range.end);
		return res;
	}

	public boolean connectToThis(Range<T> range){
		if(!isCommon(range)) return false;
		start = start.compareTo(range.start) <= 0 ? start : range.start;
		end = end.compareTo(range.end) >= 0 ? end : range.end;
		return true;
	}
	@Override
	public int compareTo(Range<T> range) {
		int res = start.compareTo(range.start);
		if(res == 0) return end.compareTo(range.end);
		return res;
	}

	public String toString(){
		return "["+start+","+end+"]";
	}
}

class RangeSet<T extends Comparable<T>>{
	TreeSet<Range<T>> ranges = new TreeSet<Range<T>>();
	public void add(Range<T> range){
		Range<T> con = ranges.floor(range);
		if(con != null){
			if(con.connectToThis(range))
				range = con;
		}
		con = ranges.ceiling(range);
		while(con != null && range.connectToThis(con)){
			ranges.remove(con);
			con = ranges.ceiling(range);
		}
		ranges.add(range);
	}

	public String toString(){
		StringBuilder bld = new StringBuilder();
		for(Range<T> r: ranges){
			bld.append(r+"\n");
		}
		return bld.toString();
	}
}

class MyMath{
	public static long fact(long n){
		long res = 1;
		while(n > 0){
			res *= n--;
		}
		return res;
	}
	public static long[][] pascalT(int n){
		long[][] tri = new long[n][];
		for(int i=0; i<n; i++){
			tri[i] = new long[i+1];
			for(int j=0; j<i+1; j++){
				if(j == 0 || j == i){
					tri[i][j] = 1;
				}else{
					tri[i][j] = tri[i-1][j-1] + tri[i-1][j];
				}
			}
		}
		return tri;
	}
}

class ContestScanner{
	private BufferedReader reader;
	private String[] line;
	private int idx;
	public ContestScanner() throws FileNotFoundException{
		reader = new BufferedReader(new InputStreamReader(System.in));
	}

	public String nextToken() throws IOException{
		if(line == null || line.length <= idx){
			line = reader.readLine().trim().split(" ");
			idx = 0;
		}
		return line[idx++];
	}

	public long nextLong() throws IOException, NumberFormatException{
		return Long.parseLong(nextToken());
	}

	public int nextInt() throws NumberFormatException, IOException{
		return (int)nextLong();
	}

	public double nextDouble() throws NumberFormatException, IOException{
		return Double.parseDouble(nextToken());
	}
}


import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.PriorityQueue;
import java.util.TreeSet;
public class Main {
	public static void main(String[] args) throws NumberFormatException, IOException{
		ContestScanner in = new ContestScanner();
		int n = in.nextInt();
		long[] a = new long[n];
		PriorityQueue<Long> qua = new PriorityQueue<Long>(1,new Reverse());
		long maxsub = 0;
		long nowsub = 0;
		long asum = 0;
		for(int i=0; i<n; i++){
			a[i] = in.nextLong();
			qua.add(a[i]);
			asum += 2;
		}
		int m = in.nextInt();
		long[] b = new long[m];
		PriorityQueue<Long> qub = new PriorityQueue<Long>(1,new Reverse());
		long bsum = 0;
		for(int i=0; i<m; i++){
			b[i] = in.nextLong();
			qub.add(b[i]);
			bsum += 2;
		}
//		int maxIdx = 0;
		nowsub = asum-bsum;
		maxsub = nowsub;
		long maxa = asum;
		long maxb = bsum;
		while(!qua.isEmpty() && !qub.isEmpty()){
			long at = qua.peek();
			long bt = qub.peek();
			if(at == bt){
				asum++;
				bsum++;
				qua.poll();
				qub.poll();
			}else if(at < bt){
				while(qub.peek() == bt){
					bsum++;
					qub.poll();
				}
			}else if(at > bt){
				while(qua.peek() == at){
					asum++;
					qua.poll();
				}
			}
			nowsub = asum-bsum;
			if(nowsub >= maxsub){
				System.err.println(maxsub);
				maxsub = nowsub;
				maxa = asum;
				maxb = bsum;
			}
		}
		if(!qua.isEmpty()){
			asum += qua.size();
			nowsub = asum - bsum;
			if(nowsub >= maxsub){
				maxsub = nowsub;
				maxa = asum;
				maxb = bsum;
			}
		}
		System.out.println(maxa+":"+maxb);
	}

}

class MyComp implements Comparator<int[]>{
	public int compare(int[] a, int[] b) {
		return a[0] - b[0];
	}
}

class Reverse implements Comparator<Long>{
	public int compare(Long arg0, Long arg1) {
		return Long.compare(arg1, arg0);
	}
}

class Node{
	int id;
	List<Node> edge = new ArrayList<Node>();
	public Node(int id){
		this.id = id;
	}
	public void createEdge(Node node){
		edge.add(node);
	}
}

class NodeW{
	int id;
	List<NodeW> edge = new ArrayList<NodeW>();
	List<Integer> costList = new ArrayList<Integer>();
	public NodeW(int id) {
		this.id = id;
	}
	public void createEdge(NodeW node, int cost) {
		edge.add(node);
		costList.add(cost);
	}
}

class Range<T extends Comparable<T>> implements Comparable<Range<T>>{
	T start;
	T end;
	public Range(T start, T end){
		this.start = start;
		this.end = end;
	}
	public boolean inRange(T val){
		if(start.compareTo(val) <= 0 && end.compareTo(val) >= 0){
			return true;
		}
		return false;
	}

	public boolean isCommon(Range<T> range){
		if(inRange(range.start) || inRange(range.end) || range.inRange(start)){
			return true;
		}
		return false;
	}

	public Range<T> connect(Range<T> range){
		if(!isCommon(range)) return null;
		Range<T> res = new Range<T>(start.compareTo(range.start) <= 0 ? start : range.start,
				end.compareTo(range.end) >= 0 ? end : range.end);
		return res;
	}

	public boolean connectToThis(Range<T> range){
		if(!isCommon(range)) return false;
		start = start.compareTo(range.start) <= 0 ? start : range.start;
		end = end.compareTo(range.end) >= 0 ? end : range.end;
		return true;
	}
	@Override
	public int compareTo(Range<T> range) {
		int res = start.compareTo(range.start);
		if(res == 0) return end.compareTo(range.end);
		return res;
	}

	public String toString(){
		return "["+start+","+end+"]";
	}
}

class RangeSet<T extends Comparable<T>>{
	TreeSet<Range<T>> ranges = new TreeSet<Range<T>>();
	public void add(Range<T> range){
		Range<T> con = ranges.floor(range);
		if(con != null){
			if(con.connectToThis(range))
				range = con;
		}
		con = ranges.ceiling(range);
		while(con != null && range.connectToThis(con)){
			ranges.remove(con);
			con = ranges.ceiling(range);
		}
		ranges.add(range);
	}

	public String toString(){
		StringBuilder bld = new StringBuilder();
		for(Range<T> r: ranges){
			bld.append(r+"\n");
		}
		return bld.toString();
	}
}

class MyMath{
	public static long fact(long n){
		long res = 1;
		while(n > 0){
			res *= n--;
		}
		return res;
	}
	public static long[][] pascalT(int n){
		long[][] tri = new long[n][];
		for(int i=0; i<n; i++){
			tri[i] = new long[i+1];
			for(int j=0; j<i+1; j++){
				if(j == 0 || j == i){
					tri[i][j] = 1;
				}else{
					tri[i][j] = tri[i-1][j-1] + tri[i-1][j];
				}
			}
		}
		return tri;
	}
}

class ContestScanner{
	private BufferedReader reader;
	private String[] line;
	private int idx;
	public ContestScanner() throws FileNotFoundException{
		reader = new BufferedReader(new InputStreamReader(System.in));
	}

	public String nextToken() throws IOException{
		if(line == null || line.length <= idx){
			line = reader.readLine().trim().split(" ");
			idx = 0;
		}
		return line[idx++];
	}

	public long nextLong() throws IOException, NumberFormatException{
		return Long.parseLong(nextToken());
	}

	public int nextInt() throws NumberFormatException, IOException{
		return (int)nextLong();
	}

	public double nextDouble() throws NumberFormatException, IOException{
		return Double.parseDouble(nextToken());
	}
}


import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.PriorityQueue;
import java.util.TreeSet;
public class Main {
	public static void main(String[] args) throws NumberFormatException, IOException{
		ContestScanner in = new ContestScanner();
		int n = in.nextInt();
		long[] a = new long[n];
		PriorityQueue<Long> qua = new PriorityQueue<Long>(1,new Reverse());
		long maxsub = 0;
		long nowsub = 0;
		long asum = 0;
		for(int i=0; i<n; i++){
			a[i] = in.nextLong();
			qua.add(a[i]);
			asum += 2;
		}
		int m = in.nextInt();
		long[] b = new long[m];
		PriorityQueue<Long> qub = new PriorityQueue<Long>(1,new Reverse());
		long bsum = 0;
		for(int i=0; i<m; i++){
			b[i] = in.nextLong();
			qub.add(b[i]);
			bsum += 2;
		}
//		int maxIdx = 0;
		nowsub = asum-bsum;
		maxsub = nowsub;
		long maxa = asum;
		long maxb = bsum;
		while(!qua.isEmpty() && !qub.isEmpty()){
			long at = qua.peek();
			long bt = qub.peek();
			if(at == bt){
				asum++;
				bsum++;
				qua.poll();
				qub.poll();
			}else if(at < bt){
				bsum++;
				qub.poll();
			}else if(at > bt){
				asum++;
				qua.poll();
			}
			nowsub = asum-bsum;
			if(nowsub >= maxsub){
				System.err.println(maxsub);
				maxsub = nowsub;
				maxa = asum;
				maxb = bsum;
			}
		}
		if(!qua.isEmpty()){
			asum += qua.size();
			nowsub = asum - bsum;
			if(nowsub >= maxsub){
				maxsub = nowsub;
				maxa = asum;
				maxb = bsum;
			}
		}
		System.out.println(maxa+":"+maxb);
	}

}

class MyComp implements Comparator<int[]>{
	public int compare(int[] a, int[] b) {
		return a[0] - b[0];
	}
}

class Reverse implements Comparator<Long>{
	public int compare(Long arg0, Long arg1) {
		return Long.compare(arg1, arg0);
	}
}

class Node{
	int id;
	List<Node> edge = new ArrayList<Node>();
	public Node(int id){
		this.id = id;
	}
	public void createEdge(Node node){
		edge.add(node);
	}
}

class NodeW{
	int id;
	List<NodeW> edge = new ArrayList<NodeW>();
	List<Integer> costList = new ArrayList<Integer>();
	public NodeW(int id) {
		this.id = id;
	}
	public void createEdge(NodeW node, int cost) {
		edge.add(node);
		costList.add(cost);
	}
}

class Range<T extends Comparable<T>> implements Comparable<Range<T>>{
	T start;
	T end;
	public Range(T start, T end){
		this.start = start;
		this.end = end;
	}
	public boolean inRange(T val){
		if(start.compareTo(val) <= 0 && end.compareTo(val) >= 0){
			return true;
		}
		return false;
	}

	public boolean isCommon(Range<T> range){
		if(inRange(range.start) || inRange(range.end) || range.inRange(start)){
			return true;
		}
		return false;
	}

	public Range<T> connect(Range<T> range){
		if(!isCommon(range)) return null;
		Range<T> res = new Range<T>(start.compareTo(range.start) <= 0 ? start : range.start,
				end.compareTo(range.end) >= 0 ? end : range.end);
		return res;
	}

	public boolean connectToThis(Range<T> range){
		if(!isCommon(range)) return false;
		start = start.compareTo(range.start) <= 0 ? start : range.start;
		end = end.compareTo(range.end) >= 0 ? end : range.end;
		return true;
	}
	@Override
	public int compareTo(Range<T> range) {
		int res = start.compareTo(range.start);
		if(res == 0) return end.compareTo(range.end);
		return res;
	}

	public String toString(){
		return "["+start+","+end+"]";
	}
}

class RangeSet<T extends Comparable<T>>{
	TreeSet<Range<T>> ranges = new TreeSet<Range<T>>();
	public void add(Range<T> range){
		Range<T> con = ranges.floor(range);
		if(con != null){
			if(con.connectToThis(range))
				range = con;
		}
		con = ranges.ceiling(range);
		while(con != null && range.connectToThis(con)){
			ranges.remove(con);
			con = ranges.ceiling(range);
		}
		ranges.add(range);
	}

	public String toString(){
		StringBuilder bld = new StringBuilder();
		for(Range<T> r: ranges){
			bld.append(r+"\n");
		}
		return bld.toString();
	}
}

class MyMath{
	public static long fact(long n){
		long res = 1;
		while(n > 0){
			res *= n--;
		}
		return res;
	}
	public static long[][] pascalT(int n){
		long[][] tri = new long[n][];
		for(int i=0; i<n; i++){
			tri[i] = new long[i+1];
			for(int j=0; j<i+1; j++){
				if(j == 0 || j == i){
					tri[i][j] = 1;
				}else{
					tri[i][j] = tri[i-1][j-1] + tri[i-1][j];
				}
			}
		}
		return tri;
	}
}

class ContestScanner{
	private BufferedReader reader;
	private String[] line;
	private int idx;
	public ContestScanner() throws FileNotFoundException{
		reader = new BufferedReader(new InputStreamReader(System.in));
	}

	public String nextToken() throws IOException{
		if(line == null || line.length <= idx){
			line = reader.readLine().trim().split(" ");
			idx = 0;
		}
		return line[idx++];
	}

	public long nextLong() throws IOException, NumberFormatException{
		return Long.parseLong(nextToken());
	}

	public int nextInt() throws NumberFormatException, IOException{
		return (int)nextLong();
	}

	public double nextDouble() throws NumberFormatException, IOException{
		return Double.parseDouble(nextToken());
	}
}


import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.PriorityQueue;
import java.util.TreeSet;
public class Main {
	public static void main(String[] args) throws NumberFormatException, IOException{
		ContestScanner in = new ContestScanner();
		int n = in.nextInt();
		long[] a = new long[n];
		PriorityQueue<Long> qua = new PriorityQueue<Long>(1,new Reverse());
		long maxsub = 0;
		long nowsub = 0;
		long asum = 0;
		for(int i=0; i<n; i++){
			a[i] = in.nextLong();
			qua.add(a[i]);
			asum += 2;
		}
		int m = in.nextInt();
		long[] b = new long[m];
		PriorityQueue<Long> qub = new PriorityQueue<Long>(1,new Reverse());
		long bsum = 0;
		for(int i=0; i<m; i++){
			b[i] = in.nextLong();
			qub.add(b[i]);
			bsum += 2;
		}
//		int maxIdx = 0;
		nowsub = asum-bsum;
		maxsub = nowsub;
		long maxa = asum;
		long maxb = bsum;
		while(!qua.isEmpty() && !qub.isEmpty()){
			long at = qua.peek();
			long bt = qub.peek();
			if(at == bt){
				asum++;
				bsum++;
				qua.poll();
				qub.poll();
			}else if(at < bt){
				while(!qub.isEmpty() && qub.peek() == bt){
					bsum++;
					qub.poll();
				}
			}else if(at > bt){
				while(!qua.isEmpty() && qua.peek() == at){
					asum++;
					qua.poll();
				}
			}
			nowsub = asum-bsum;
			if(nowsub >= maxsub){
				System.err.println(maxsub);
				maxsub = nowsub;
				maxa = asum;
				maxb = bsum;
			}
		}
		if(!qua.isEmpty()){
			asum += qua.size();
			nowsub = asum - bsum;
			if(nowsub >= maxsub){
				maxsub = nowsub;
				maxa = asum;
				maxb = bsum;
			}
		}
		System.out.println(maxa+":"+maxb);
	}

}

class MyComp implements Comparator<int[]>{
	public int compare(int[] a, int[] b) {
		return a[0] - b[0];
	}
}

class Reverse implements Comparator<Long>{
	public int compare(Long arg0, Long arg1) {
		return Long.compare(arg1, arg0);
	}
}

class Node{
	int id;
	List<Node> edge = new ArrayList<Node>();
	public Node(int id){
		this.id = id;
	}
	public void createEdge(Node node){
		edge.add(node);
	}
}

class NodeW{
	int id;
	List<NodeW> edge = new ArrayList<NodeW>();
	List<Integer> costList = new ArrayList<Integer>();
	public NodeW(int id) {
		this.id = id;
	}
	public void createEdge(NodeW node, int cost) {
		edge.add(node);
		costList.add(cost);
	}
}

class Range<T extends Comparable<T>> implements Comparable<Range<T>>{
	T start;
	T end;
	public Range(T start, T end){
		this.start = start;
		this.end = end;
	}
	public boolean inRange(T val){
		if(start.compareTo(val) <= 0 && end.compareTo(val) >= 0){
			return true;
		}
		return false;
	}

	public boolean isCommon(Range<T> range){
		if(inRange(range.start) || inRange(range.end) || range.inRange(start)){
			return true;
		}
		return false;
	}

	public Range<T> connect(Range<T> range){
		if(!isCommon(range)) return null;
		Range<T> res = new Range<T>(start.compareTo(range.start) <= 0 ? start : range.start,
				end.compareTo(range.end) >= 0 ? end : range.end);
		return res;
	}

	public boolean connectToThis(Range<T> range){
		if(!isCommon(range)) return false;
		start = start.compareTo(range.start) <= 0 ? start : range.start;
		end = end.compareTo(range.end) >= 0 ? end : range.end;
		return true;
	}
	@Override
	public int compareTo(Range<T> range) {
		int res = start.compareTo(range.start);
		if(res == 0) return end.compareTo(range.end);
		return res;
	}

	public String toString(){
		return "["+start+","+end+"]";
	}
}

class RangeSet<T extends Comparable<T>>{
	TreeSet<Range<T>> ranges = new TreeSet<Range<T>>();
	public void add(Range<T> range){
		Range<T> con = ranges.floor(range);
		if(con != null){
			if(con.connectToThis(range))
				range = con;
		}
		con = ranges.ceiling(range);
		while(con != null && range.connectToThis(con)){
			ranges.remove(con);
			con = ranges.ceiling(range);
		}
		ranges.add(range);
	}

	public String toString(){
		StringBuilder bld = new StringBuilder();
		for(Range<T> r: ranges){
			bld.append(r+"\n");
		}
		return bld.toString();
	}
}

class MyMath{
	public static long fact(long n){
		long res = 1;
		while(n > 0){
			res *= n--;
		}
		return res;
	}
	public static long[][] pascalT(int n){
		long[][] tri = new long[n][];
		for(int i=0; i<n; i++){
			tri[i] = new long[i+1];
			for(int j=0; j<i+1; j++){
				if(j == 0 || j == i){
					tri[i][j] = 1;
				}else{
					tri[i][j] = tri[i-1][j-1] + tri[i-1][j];
				}
			}
		}
		return tri;
	}
}

class ContestScanner{
	private BufferedReader reader;
	private String[] line;
	private int idx;
	public ContestScanner() throws FileNotFoundException{
		reader = new BufferedReader(new InputStreamReader(System.in));
	}

	public String nextToken() throws IOException{
		if(line == null || line.length <= idx){
			line = reader.readLine().trim().split(" ");
			idx = 0;
		}
		return line[idx++];
	}

	public long nextLong() throws IOException, NumberFormatException{
		return Long.parseLong(nextToken());
	}

	public int nextInt() throws NumberFormatException, IOException{
		return (int)nextLong();
	}

	public double nextDouble() throws NumberFormatException, IOException{
		return Double.parseDouble(nextToken());
	}
}


import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.PriorityQueue;
import java.util.TreeSet;
public class Main {
	public static void main(String[] args) throws NumberFormatException, IOException{
		ContestScanner in = new ContestScanner();
		int n = in.nextInt();
		long[] a = new long[n];
		PriorityQueue<Long> qua = new PriorityQueue<Long>();
		long maxsub = 0;
		long nowsub = 0;
		long asum = 0;
		for(int i=0; i<n; i++){
			a[i] = in.nextLong();
			qua.add(a[i]);
			asum += 2;
		}
		int m = in.nextInt();
		long[] b = new long[m];
		PriorityQueue<Long> qub = new PriorityQueue<Long>();
		long bsum = 0;
		for(int i=0; i<m; i++){
			b[i] = in.nextLong();
			qub.add(b[i]);
			bsum += 2;
		}
//		int maxIdx = 0;
		nowsub = asum-bsum;
		maxsub = nowsub;
		long maxa = asum;
		long maxb = bsum;
		while(!qua.isEmpty() && !qub.isEmpty()){
			long at = qua.peek();
			long bt = qub.peek();
			if(at == bt){
				asum++;
				bsum++;
				qua.poll();
				qub.poll();
			}else if(at < bt){
				bsum++;
				qub.poll();
			}else if(at > bt){
				asum++;
				qua.poll();
			}
			nowsub = asum-bsum;
			if(nowsub > maxsub){
				maxsub = nowsub;
				maxa = asum;
				maxb = bsum;
			}
		}
		if(!qua.isEmpty()){
			asum += qua.size();
			nowsub = asum - bsum;
			if(nowsub > maxsub){
				maxsub = nowsub;
				maxa = asum;
				maxb = bsum;
			}
		}
		System.out.println(maxa+":"+maxb);
	}

}

class MyComp implements Comparator<int[]>{
	public int compare(int[] a, int[] b) {
		return a[0] - b[0];
	}
}

class Reverse implements Comparator<Integer>{
	public int compare(Integer arg0, Integer arg1) {
		return arg1 - arg0;
	}
}

class Node{
	int id;
	List<Node> edge = new ArrayList<Node>();
	public Node(int id){
		this.id = id;
	}
	public void createEdge(Node node){
		edge.add(node);
	}
}

class NodeW{
	int id;
	List<NodeW> edge = new ArrayList<NodeW>();
	List<Integer> costList = new ArrayList<Integer>();
	public NodeW(int id) {
		this.id = id;
	}
	public void createEdge(NodeW node, int cost) {
		edge.add(node);
		costList.add(cost);
	}
}

class Range<T extends Comparable<T>> implements Comparable<Range<T>>{
	T start;
	T end;
	public Range(T start, T end){
		this.start = start;
		this.end = end;
	}
	public boolean inRange(T val){
		if(start.compareTo(val) <= 0 && end.compareTo(val) >= 0){
			return true;
		}
		return false;
	}

	public boolean isCommon(Range<T> range){
		if(inRange(range.start) || inRange(range.end) || range.inRange(start)){
			return true;
		}
		return false;
	}

	public Range<T> connect(Range<T> range){
		if(!isCommon(range)) return null;
		Range<T> res = new Range<T>(start.compareTo(range.start) <= 0 ? start : range.start,
				end.compareTo(range.end) >= 0 ? end : range.end);
		return res;
	}

	public boolean connectToThis(Range<T> range){
		if(!isCommon(range)) return false;
		start = start.compareTo(range.start) <= 0 ? start : range.start;
		end = end.compareTo(range.end) >= 0 ? end : range.end;
		return true;
	}
	@Override
	public int compareTo(Range<T> range) {
		int res = start.compareTo(range.start);
		if(res == 0) return end.compareTo(range.end);
		return res;
	}

	public String toString(){
		return "["+start+","+end+"]";
	}
}

class RangeSet<T extends Comparable<T>>{
	TreeSet<Range<T>> ranges = new TreeSet<Range<T>>();
	public void add(Range<T> range){
		Range<T> con = ranges.floor(range);
		if(con != null){
			if(con.connectToThis(range))
				range = con;
		}
		con = ranges.ceiling(range);
		while(con != null && range.connectToThis(con)){
			ranges.remove(con);
			con = ranges.ceiling(range);
		}
		ranges.add(range);
	}

	public String toString(){
		StringBuilder bld = new StringBuilder();
		for(Range<T> r: ranges){
			bld.append(r+"\n");
		}
		return bld.toString();
	}
}

class MyMath{
	public static long fact(long n){
		long res = 1;
		while(n > 0){
			res *= n--;
		}
		return res;
	}
	public static long[][] pascalT(int n){
		long[][] tri = new long[n][];
		for(int i=0; i<n; i++){
			tri[i] = new long[i+1];
			for(int j=0; j<i+1; j++){
				if(j == 0 || j == i){
					tri[i][j] = 1;
				}else{
					tri[i][j] = tri[i-1][j-1] + tri[i-1][j];
				}
			}
		}
		return tri;
	}
}

class ContestScanner{
	private BufferedReader reader;
	private String[] line;
	private int idx;
	public ContestScanner() throws FileNotFoundException{
		reader = new BufferedReader(new InputStreamReader(System.in));
	}

	public String nextToken() throws IOException{
		if(line == null || line.length <= idx){
			line = reader.readLine().trim().split(" ");
			idx = 0;
		}
		return line[idx++];
	}

	public long nextLong() throws IOException, NumberFormatException{
		return Long.parseLong(nextToken());
	}

	public int nextInt() throws NumberFormatException, IOException{
		return (int)nextLong();
	}

	public double nextDouble() throws NumberFormatException, IOException{
		return Double.parseDouble(nextToken());
	}
}


import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.PriorityQueue;
import java.util.TreeSet;
public class Main {
	public static void main(String[] args) throws NumberFormatException, IOException{
		ContestScanner in = new ContestScanner();
		int n = in.nextInt();
		long[] a = new long[n];
		PriorityQueue<Long> qua = new PriorityQueue<Long>();
		long maxsub = 0;
		long nowsub = 0;
		long asum = 0;
		for(int i=0; i<n; i++){
			a[i] = in.nextLong();
			qua.add(a[i]);
			asum += 2;
		}
		int m = in.nextInt();
		long[] b = new long[m];
		PriorityQueue<Long> qub = new PriorityQueue<Long>();
		long bsum = 0;
		for(int i=0; i<m; i++){
			b[i] = in.nextLong();
			qub.add(b[i]);
			bsum += 2;
		}
//		int maxIdx = 0;
		nowsub = asum-bsum;
		maxsub = nowsub;
		long maxa = asum;
		long maxb = bsum;
		while(!qua.isEmpty() && !qub.isEmpty()){
			long at = qua.peek();
			long bt = qub.peek();
			if(at == bt){
				asum++;
				bsum++;
				qua.poll();
				qub.poll();
			}else if(at < bt){
				bsum++;
				qub.poll();
			}else if(at > bt){
				asum++;
				qua.poll();
			}
			nowsub = asum-bsum;
			if(nowsub >= maxsub){
				maxsub = nowsub;
				maxa = asum;
				maxb = bsum;
			}
		}
		if(!qua.isEmpty()){
			asum += qua.size();
			nowsub = asum - bsum;
			if(nowsub >= maxsub){
				maxsub = nowsub;
				maxa = asum;
				maxb = bsum;
			}
		}
		System.out.println(maxa+":"+maxb);
	}

}

class MyComp implements Comparator<int[]>{
	public int compare(int[] a, int[] b) {
		return a[0] - b[0];
	}
}

class Reverse implements Comparator<Integer>{
	public int compare(Integer arg0, Integer arg1) {
		return arg1 - arg0;
	}
}

class Node{
	int id;
	List<Node> edge = new ArrayList<Node>();
	public Node(int id){
		this.id = id;
	}
	public void createEdge(Node node){
		edge.add(node);
	}
}

class NodeW{
	int id;
	List<NodeW> edge = new ArrayList<NodeW>();
	List<Integer> costList = new ArrayList<Integer>();
	public NodeW(int id) {
		this.id = id;
	}
	public void createEdge(NodeW node, int cost) {
		edge.add(node);
		costList.add(cost);
	}
}

class Range<T extends Comparable<T>> implements Comparable<Range<T>>{
	T start;
	T end;
	public Range(T start, T end){
		this.start = start;
		this.end = end;
	}
	public boolean inRange(T val){
		if(start.compareTo(val) <= 0 && end.compareTo(val) >= 0){
			return true;
		}
		return false;
	}

	public boolean isCommon(Range<T> range){
		if(inRange(range.start) || inRange(range.end) || range.inRange(start)){
			return true;
		}
		return false;
	}

	public Range<T> connect(Range<T> range){
		if(!isCommon(range)) return null;
		Range<T> res = new Range<T>(start.compareTo(range.start) <= 0 ? start : range.start,
				end.compareTo(range.end) >= 0 ? end : range.end);
		return res;
	}

	public boolean connectToThis(Range<T> range){
		if(!isCommon(range)) return false;
		start = start.compareTo(range.start) <= 0 ? start : range.start;
		end = end.compareTo(range.end) >= 0 ? end : range.end;
		return true;
	}
	@Override
	public int compareTo(Range<T> range) {
		int res = start.compareTo(range.start);
		if(res == 0) return end.compareTo(range.end);
		return res;
	}

	public String toString(){
		return "["+start+","+end+"]";
	}
}

class RangeSet<T extends Comparable<T>>{
	TreeSet<Range<T>> ranges = new TreeSet<Range<T>>();
	public void add(Range<T> range){
		Range<T> con = ranges.floor(range);
		if(con != null){
			if(con.connectToThis(range))
				range = con;
		}
		con = ranges.ceiling(range);
		while(con != null && range.connectToThis(con)){
			ranges.remove(con);
			con = ranges.ceiling(range);
		}
		ranges.add(range);
	}

	public String toString(){
		StringBuilder bld = new StringBuilder();
		for(Range<T> r: ranges){
			bld.append(r+"\n");
		}
		return bld.toString();
	}
}

class MyMath{
	public static long fact(long n){
		long res = 1;
		while(n > 0){
			res *= n--;
		}
		return res;
	}
	public static long[][] pascalT(int n){
		long[][] tri = new long[n][];
		for(int i=0; i<n; i++){
			tri[i] = new long[i+1];
			for(int j=0; j<i+1; j++){
				if(j == 0 || j == i){
					tri[i][j] = 1;
				}else{
					tri[i][j] = tri[i-1][j-1] + tri[i-1][j];
				}
			}
		}
		return tri;
	}
}

class ContestScanner{
	private BufferedReader reader;
	private String[] line;
	private int idx;
	public ContestScanner() throws FileNotFoundException{
		reader = new BufferedReader(new InputStreamReader(System.in));
	}

	public String nextToken() throws IOException{
		if(line == null || line.length <= idx){
			line = reader.readLine().trim().split(" ");
			idx = 0;
		}
		return line[idx++];
	}

	public long nextLong() throws IOException, NumberFormatException{
		return Long.parseLong(nextToken());
	}

	public int nextInt() throws NumberFormatException, IOException{
		return (int)nextLong();
	}

	public double nextDouble() throws NumberFormatException, IOException{
		return Double.parseDouble(nextToken());
	}
}


import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.PriorityQueue;
import java.util.TreeSet;
public class Main {
	public static void main(String[] args) throws NumberFormatException, IOException{
		ContestScanner in = new ContestScanner();
		int n = in.nextInt();
		long[] a = new long[n];
		PriorityQueue<Long> qua = new PriorityQueue<Long>(new Reverse());
		long maxsub = 0;
		long nowsub = 0;
		long asum = 0;
		for(int i=0; i<n; i++){
			a[i] = in.nextLong();
			qua.add(a[i]);
			asum += 2;
		}
		int m = in.nextInt();
		long[] b = new long[m];
		PriorityQueue<Long> qub = new PriorityQueue<Long>(new Reverse());
		long bsum = 0;
		for(int i=0; i<m; i++){
			b[i] = in.nextLong();
			qub.add(b[i]);
			bsum += 2;
		}
//		int maxIdx = 0;
		nowsub = asum-bsum;
		maxsub = nowsub;
		long maxa = asum;
		long maxb = bsum;
		while(!qua.isEmpty() && !qub.isEmpty()){
			long at = qua.peek();
			long bt = qub.peek();
			if(at == bt){
				asum++;
				bsum++;
				qua.poll();
				qub.poll();
			}else if(at < bt){
				bsum++;
				qub.poll();
			}else if(at > bt){
				asum++;
				qua.poll();
			}
			nowsub = asum-bsum;
			if(nowsub >= maxsub){
				System.err.println(maxsub);
				maxsub = nowsub;
				maxa = asum;
				maxb = bsum;
			}
		}
		if(!qua.isEmpty()){
			asum += qua.size();
			nowsub = asum - bsum;
			if(nowsub >= maxsub){
				maxsub = nowsub;
				maxa = asum;
				maxb = bsum;
			}
		}
		System.out.println(maxa+":"+maxb);
	}

}

class MyComp implements Comparator<int[]>{
	public int compare(int[] a, int[] b) {
		return a[0] - b[0];
	}
}

class Reverse implements Comparator<Long>{
	public int compare(Long arg0, Long arg1) {
		return Long.compare(arg1, arg0);
	}
}

class Node{
	int id;
	List<Node> edge = new ArrayList<Node>();
	public Node(int id){
		this.id = id;
	}
	public void createEdge(Node node){
		edge.add(node);
	}
}

class NodeW{
	int id;
	List<NodeW> edge = new ArrayList<NodeW>();
	List<Integer> costList = new ArrayList<Integer>();
	public NodeW(int id) {
		this.id = id;
	}
	public void createEdge(NodeW node, int cost) {
		edge.add(node);
		costList.add(cost);
	}
}

class Range<T extends Comparable<T>> implements Comparable<Range<T>>{
	T start;
	T end;
	public Range(T start, T end){
		this.start = start;
		this.end = end;
	}
	public boolean inRange(T val){
		if(start.compareTo(val) <= 0 && end.compareTo(val) >= 0){
			return true;
		}
		return false;
	}

	public boolean isCommon(Range<T> range){
		if(inRange(range.start) || inRange(range.end) || range.inRange(start)){
			return true;
		}
		return false;
	}

	public Range<T> connect(Range<T> range){
		if(!isCommon(range)) return null;
		Range<T> res = new Range<T>(start.compareTo(range.start) <= 0 ? start : range.start,
				end.compareTo(range.end) >= 0 ? end : range.end);
		return res;
	}

	public boolean connectToThis(Range<T> range){
		if(!isCommon(range)) return false;
		start = start.compareTo(range.start) <= 0 ? start : range.start;
		end = end.compareTo(range.end) >= 0 ? end : range.end;
		return true;
	}
	@Override
	public int compareTo(Range<T> range) {
		int res = start.compareTo(range.start);
		if(res == 0) return end.compareTo(range.end);
		return res;
	}

	public String toString(){
		return "["+start+","+end+"]";
	}
}

class RangeSet<T extends Comparable<T>>{
	TreeSet<Range<T>> ranges = new TreeSet<Range<T>>();
	public void add(Range<T> range){
		Range<T> con = ranges.floor(range);
		if(con != null){
			if(con.connectToThis(range))
				range = con;
		}
		con = ranges.ceiling(range);
		while(con != null && range.connectToThis(con)){
			ranges.remove(con);
			con = ranges.ceiling(range);
		}
		ranges.add(range);
	}

	public String toString(){
		StringBuilder bld = new StringBuilder();
		for(Range<T> r: ranges){
			bld.append(r+"\n");
		}
		return bld.toString();
	}
}

class MyMath{
	public static long fact(long n){
		long res = 1;
		while(n > 0){
			res *= n--;
		}
		return res;
	}
	public static long[][] pascalT(int n){
		long[][] tri = new long[n][];
		for(int i=0; i<n; i++){
			tri[i] = new long[i+1];
			for(int j=0; j<i+1; j++){
				if(j == 0 || j == i){
					tri[i][j] = 1;
				}else{
					tri[i][j] = tri[i-1][j-1] + tri[i-1][j];
				}
			}
		}
		return tri;
	}
}

class ContestScanner{
	private BufferedReader reader;
	private String[] line;
	private int idx;
	public ContestScanner() throws FileNotFoundException{
		reader = new BufferedReader(new InputStreamReader(System.in));
	}

	public String nextToken() throws IOException{
		if(line == null || line.length <= idx){
			line = reader.readLine().trim().split(" ");
			idx = 0;
		}
		return line[idx++];
	}

	public long nextLong() throws IOException, NumberFormatException{
		return Long.parseLong(nextToken());
	}

	public int nextInt() throws NumberFormatException, IOException{
		return (int)nextLong();
	}

	public double nextDouble() throws NumberFormatException, IOException{
		return Double.parseDouble(nextToken());
	}
}


import java.io.*;
import java.util.*;

public class P3 {
	public static void main (String[] args) {
		Scanner sc = new Scanner (System.in);
		PrintStream op = System.out;
		long n = sc.nextLong();
		int[] a = new int [(int)n];
		for (int i = 0; i < n; i++)
			a[i] = sc.nextInt();
		long m = sc.nextLong();
		int[] b = new int [(int)m];
		for (int i = 0; i < m; i++)
			b[i] = sc.nextInt();
		Arrays.sort(a);
		Arrays.sort(b);
		long mA = n * 2, mB = m * 2;
		for (long i = n - 1, j = m - 1; i >= 0;) {
			while (i > 0 && a[(int)i] == a[(int)i - 1])
				i--;
			while (j >= 0 && a[(int)i] <= b[(int)j])
				j--;
			long A = 2 * i + 3 * (n - i);
			long B = 2 * (j + 1) + 3 * (m - j - 1);
			if (A - B > mA - mB) {
				mA = A;
				mB = B;
			}
			i--;
		}
		op.println(mA + ":" + mB);
		sc.close();
	}
}


import java.io.*;
import java.util.*;

public class P3 {
	public static void main (String[] args) {
		Scanner sc = new Scanner (System.in);
		PrintStream op = System.out;
		long n = sc.nextLong();
		int[] a = new int [(int)n];
		for (int i = 0; i < n; i++)
			a[i] = sc.nextInt();
		long m = sc.nextLong();
		int[] b = new int [(int)m];
		for (int i = 0; i < m; i++)
			b[i] = sc.nextInt();
		Arrays.sort(a);
		Arrays.sort(b);
		long mA = n * 2, mB = m * 2;
		for (long i = n - 1, j = m - 1; i >= 0;) {
			while (i > 0 && a[(int)i] == a[(int)i - 1])
				i--;
			while (j >= 0 && a[(int)i] <= b[(int)j])
				j--;
			long A = 2 * i + 3 * (n - i);
			long B = 2 * (j + 1) + 3 * (m - j - 1);
			if (A - B > mA - mB || (A - B == mA - mB && A > mA)) {
				mA = A;
				mB = B;
			}
			i--;
		}
		op.println(mA + ":" + mB);
		sc.close();
	}
}


import java.io.*;
import java.math.*;
import java.util.*;

public class Program {

    BufferedReader br;
    PrintWriter out;
    StringTokenizer st;
    boolean eof;

    static final int MOD = 1000000007;
    static final double INF = 10000000000.0;
    static final int MAX = 10000001;

    void solve() throws IOException {
    	int n, m;
    	int[] a, b;
    	n = nextInt();
    	a = new int[n];
    	for(int i = 0; i < n; i++)
    		a[i] = nextInt();
    	m = nextInt();
    	b = new int[m];
    	for(int i = 0; i < m; i++)
    		b[i] = nextInt();
    	Arrays.sort(a);
    	Arrays.sort(b);
    	int ans = n*3 - m*3, j = 0, xmin = n*3;
    	int dx, dy;
    	dx = n*3;
    	dy = m*3;
    	for(int i = 0; i < n; i++)
    	{
    		int x, y;
    		while(j < m && b[j] < a[i])
    			j++;
    		x = (n-i) * 3 + i * 2;
    		y = (m-j) * 3 + j * 2;
    		if (ans < x - y || (x-y == ans && xmin < x))
    		{
    			dx = x;
    			dy = y;
    			ans = x-y;
    			xmin = x;
    		}
    	}
    	int x, y;
    	x = n*2;
    	y = m*2;
    	if (ans < x - y || (x-y == ans && xmin < x))
    	{
    		dx = x;
    		dy = y;
    		ans = x-y;
    		xmin = x;
    	}
    	out.println(dx + ":" + dy);
    }

    Program() throws IOException {
        br = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        solve();
        out.close();
    }

    public static void main(String[] args) throws IOException {
        new Program();
    }

    String nextToken() {
        while (st == null || !st.hasMoreTokens()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (Exception e) {
                eof = true;
                return null;
            }
        }
        return st.nextToken();
    }

    String nextString() {
        try {
            return br.readLine();
        } catch (IOException e) {
            eof = true;
            return null;
        }
    }

    int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }

    long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }

    double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }

    class Pair implements Comparable<Pair>{

        char first;
        int second;

        public Pair(char an1, int an2){
            first = an1;
            second = an2;
        }

        @Override
        public int compareTo(Pair o) {
            if (first - o.first == 0)
            	return second - o.second;
            else
            	return first - o.first;
        }
    }
}