# Arup Guha
# 7/17/2013
# Example Sorting Objects

from Contact import Contact

def main():

    # Open file.
    myFile = open("contacts.txt", "r")

    # Set up list.
    people = []
    n = int(myFile.readline())

    # Read data.
    for i in range(n):
        tokens = myFile.readline().split()
        person = Contact(tokens[0], int(tokens[1]), int(tokens[2]), int(tokens[3]), int(tokens[4]))
        people.append(person)

    # Sort by specifying a key.
    people.sort(key=lambda Contact: Contact.name)

    # Print
    for i in range(n):
        print(people[i])

    # Close the file.
    myFile.close()

main()
