#! /usr/bin/env python

def cal(blocks, n):
    buf = 0
    ans = n
    for b in blocks:
        if b[1]:
            buf += 1
        else:
            if buf > 0:
                buf -= 1
            else:
                ans -= 1
    return ans


T = int(input())
for t in range(1, T+1):
    n = int(input())
    blocks = []
    blocks += [(float(x), 1) for x in input().split()]
    blocks += [(float(x), 0) for x in input().split()]
    blocks.sort(key=lambda x: x[0])
    ans = n - cal(blocks, n)
    cans = cal(reversed(blocks), n)
    print("Case #{}: {} {}".format(t, cans, ans))

c7c609b6216d33b3da50f20374d98db56dbd11d9
<mask token>

def cal(blocks, n):
    buf = 0
    ans = n
    for b in blocks:
        if b[1]:
            buf += 1
        elif buf > 0:
            buf -= 1
        else:
            ans -= 1
    return ans


<mask token>

def cal(blocks, n):
    buf = 0
    ans = n
    for b in blocks:
        if b[1]:
            buf += 1
        elif buf > 0:
            buf -= 1
        else:
            ans -= 1
    return ans


<mask token>
for t in range(1, T + 1):
    n = int(input())
    blocks = []
    blocks += [(float(x), 1) for x in input().split()]
    blocks += [(float(x), 0) for x in input().split()]
    blocks.sort(key=lambda x: x[0])
    ans = n - cal(blocks, n)
    cans = cal(reversed(blocks), n)
    print('Case #{}: {} {}'.format(t, cans, ans))

def cal(blocks, n):
    buf = 0
    ans = n
    for b in blocks:
        if b[1]:
            buf += 1
        elif buf > 0:
            buf -= 1
        else:
            ans -= 1
    return ans


T = int(input())
for t in range(1, T + 1):
    n = int(input())
    blocks = []
    blocks += [(float(x), 1) for x in input().split()]
    blocks += [(float(x), 0) for x in input().split()]
    blocks.sort(key=lambda x: x[0])
    ans = n - cal(blocks, n)
    cans = cal(reversed(blocks), n)
    print('Case #{}: {} {}'.format(t, cans, ans))

#! /usr/bin/env python

def cal(blocks, n):
    buf = 0
    ans = n
    for b in blocks:
        if b[1]:
            buf += 1
        else:
            if buf > 0:
                buf -= 1
            else:
                ans -= 1
    return ans


T = int(input())
for t in range(1, T+1):
    n = int(input())
    blocks = []
    blocks += [(float(x), 1) for x in input().split()]
    blocks += [(float(x), 0) for x in input().split()]
    blocks.sort(key=lambda x: x[0])
    ans = n - cal(blocks, n)
    cans = cal(reversed(blocks), n)
    print("Case #{}: {} {}".format(t, cans, ans))
