# Arup Guha
# 4/3/2020
# Example showing how to use readline with more than 1 token per line.

# Open the file.
myFile = open("names.txt", "r")
numPeople = int(myFile.readline().strip())

for i in range(numPeople):

    # Splits line into separate tokens.
    line = myFile.readline().split()

    # Number of names.
    numNames = int(line[0])

    # Print first name.
    print(line[1],end="")

    # Print all subsequent names with a space before each.
    for i in range(2,numNames+1):
        print(" "+line[i], end="")

    # Extract month and day.
    month = int(line[numNames+1])
    day = int(line[numNames+2])

    # Print out the birthday.
    print(" BDAY IS ",month,"/",day, sep="")

# Don't forget this!!!
myFile.close()
