#  Hint:  You may not need all of these.  Remove the unused functions.
from hashtables import (HashTable,
                        hash_table_insert,
                        hash_table_remove,
                        hash_table_retrieve,
                        hash_table_resize)


class Ticket:
    def __init__(self, source, destination):
        self.source = source
        self.destination = destination


def reconstruct_trip(tickets, length):
    hashtable = HashTable(length)
    route = [None] * length
    # tickets = EX: [ticket_1, ticket_2, ticket_3]
    # length = lenght of tickets
    """
    YOUR CODE HERE
    """
# The ticket for your first flight has a destination with a `source` of `NONE`
    key = "NONE"

# insert values
    for i in tickets:
        hash_table_insert(hashtable, i.source, i.destination)

# retrieve values
    for src in range(length):
        i = hash_table_retrieve(hashtable, key)
        route[src] = i
        key = i
    return route
