T = int(input())
for t in range(T):
    n = int(input())
    a = input().split()
    ans = 0
    tmp = 0
    for i in range(n):
        for j in range(i):
            tmp = int(a[j] + a[i])
            if (tmp > ans):
                ans = tmp
    print("Case #" + str(t + 1) + ": " + str(ans))