# 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")
toks = myFile.read().split()
numPeople = int(toks[0])

# Keeps track of which token I am on in the list of tokens.
curTokIdx = 1

for i in range(numPeople):

    # Number of names.
    numNames = int(toks[curTokIdx])
    curTokIdx += 1

    # Print first name.
    print(toks[curTokIdx],end="")
    curTokIdx += 1
    
    # Print all subsequent names with a space before each.
    for i in range(0,numNames-1):
        print(" "+toks[curTokIdx], end="")
        curTokIdx += 1
        
    # Extract month and day.
    month = int(toks[curTokIdx])
    day = int(toks[curTokIdx+1])
    curTokIdx += 2
    
    # Print out the birthday.
    print(" BDAY IS ",month,"/",day, sep="")

# Don't forget this!!!
myFile.close()
