# Arup Guha
# 7/18/2012
# Solution to BHCSI Contest Problem: ID Numbers

def main():

    IDOFFSET = 11

    myFile = open("idnum.in", "r")

    numCases = int(myFile.readline())

    for loop in range(numCases):

        numKids = int(myFile.readline())
        startID = int(myFile.readline())

        # Create a dictionary look-up of IDs and a list of names.
        id_list = {}
        name_list = []

        # Read in each name, storing in the dictionary and list.
        # The loop is set up to go through the ID numbers appropriately.
        for idnum in range(startID, startID + IDOFFSET*numKids, IDOFFSET):

            name = myFile.readline().rstrip('\n')
            id_list[name] = idnum
            name_list.append(name)

        # Get the names in alpha order.
        name_list.sort()

        # Print out this case, ordered based on name_list.
        print("Summer camp #", (loop+1), ":", sep="")
        for i in range(len(name_list)):
            print(name_list[i],id_list[name_list[i]])
        print()

    myFile.close()

main()
            
            
