#  Hint:  You may not need all of these.  Remove the unused functions.
class Ticket:
    def __init__(self, source, destination):
        self.source = source
        self.destination = destination


def reconstruct_trip(tickets, length):
    """
    YOUR CODE HERE
    """
    hash = {}
    route = [None] * length

    for index in range(len(tickets)):
        if tickets[index].source == "NONE":
            route[0] = tickets[index].destination

        if tickets[index].source not in hash:
            hash[tickets[index].source] = tickets[index].destination

    for item in range(length):
        if route[item - 1] is not None:
            route[item] = hash[route[item - 1]]

    return route


print("*** Test 1 ***")
ticket_1 = Ticket("NONE", "PDX")
ticket_2 = Ticket("PDX", "DCA")
ticket_3 = Ticket("DCA", "NONE")

tickets = [ticket_1, ticket_2, ticket_3]

print(reconstruct_trip(tickets, len(tickets)))

print("*** Test 2 ***")
ticket_1 = Ticket("PIT", "ORD")
ticket_2 = Ticket("XNA", "SAP")
ticket_3 = Ticket("SFO", "BHM")
ticket_4 = Ticket("FLG", "XNA")
ticket_5 = Ticket("NONE", "LAX")
ticket_6 = Ticket("LAX", "SFO")
ticket_7 = Ticket("SAP", "SLC")
ticket_8 = Ticket("ORD", "NONE")
ticket_9 = Ticket("SLC", "PIT")
ticket_10 = Ticket("BHM", "FLG")

tickets = [ticket_1, ticket_2, ticket_3, ticket_4, ticket_5,
           ticket_6, ticket_7, ticket_8, ticket_9, ticket_10]

print(reconstruct_trip(tickets, len(tickets)))

80b2456a6ce9d95bf8c6128e0acf5eec40914438
class Ticket:

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


<mask token>

class Ticket:

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


def reconstruct_trip(tickets, length):
    """
    YOUR CODE HERE
    """
    hash = {}
    route = [None] * length
    for index in range(len(tickets)):
        if tickets[index].source == 'NONE':
            route[0] = tickets[index].destination
        if tickets[index].source not in hash:
            hash[tickets[index].source] = tickets[index].destination
    for item in range(length):
        if route[item - 1] is not None:
            route[item] = hash[route[item - 1]]
    return route


<mask token>

class Ticket:

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


def reconstruct_trip(tickets, length):
    """
    YOUR CODE HERE
    """
    hash = {}
    route = [None] * length
    for index in range(len(tickets)):
        if tickets[index].source == 'NONE':
            route[0] = tickets[index].destination
        if tickets[index].source not in hash:
            hash[tickets[index].source] = tickets[index].destination
    for item in range(length):
        if route[item - 1] is not None:
            route[item] = hash[route[item - 1]]
    return route


print('*** Test 1 ***')
<mask token>
print(reconstruct_trip(tickets, len(tickets)))
print('*** Test 2 ***')
<mask token>
print(reconstruct_trip(tickets, len(tickets)))

class Ticket:

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


def reconstruct_trip(tickets, length):
    """
    YOUR CODE HERE
    """
    hash = {}
    route = [None] * length
    for index in range(len(tickets)):
        if tickets[index].source == 'NONE':
            route[0] = tickets[index].destination
        if tickets[index].source not in hash:
            hash[tickets[index].source] = tickets[index].destination
    for item in range(length):
        if route[item - 1] is not None:
            route[item] = hash[route[item - 1]]
    return route


print('*** Test 1 ***')
ticket_1 = Ticket('NONE', 'PDX')
ticket_2 = Ticket('PDX', 'DCA')
ticket_3 = Ticket('DCA', 'NONE')
tickets = [ticket_1, ticket_2, ticket_3]
print(reconstruct_trip(tickets, len(tickets)))
print('*** Test 2 ***')
ticket_1 = Ticket('PIT', 'ORD')
ticket_2 = Ticket('XNA', 'SAP')
ticket_3 = Ticket('SFO', 'BHM')
ticket_4 = Ticket('FLG', 'XNA')
ticket_5 = Ticket('NONE', 'LAX')
ticket_6 = Ticket('LAX', 'SFO')
ticket_7 = Ticket('SAP', 'SLC')
ticket_8 = Ticket('ORD', 'NONE')
ticket_9 = Ticket('SLC', 'PIT')
ticket_10 = Ticket('BHM', 'FLG')
tickets = [ticket_1, ticket_2, ticket_3, ticket_4, ticket_5, ticket_6,
    ticket_7, ticket_8, ticket_9, ticket_10]
print(reconstruct_trip(tickets, len(tickets)))

#  Hint:  You may not need all of these.  Remove the unused functions.
class Ticket:
    def __init__(self, source, destination):
        self.source = source
        self.destination = destination


def reconstruct_trip(tickets, length):
    """
    YOUR CODE HERE
    """
    hash = {}
    route = [None] * length

    for index in range(len(tickets)):
        if tickets[index].source == "NONE":
            route[0] = tickets[index].destination

        if tickets[index].source not in hash:
            hash[tickets[index].source] = tickets[index].destination

    for item in range(length):
        if route[item - 1] is not None:
            route[item] = hash[route[item - 1]]

    return route


print("*** Test 1 ***")
ticket_1 = Ticket("NONE", "PDX")
ticket_2 = Ticket("PDX", "DCA")
ticket_3 = Ticket("DCA", "NONE")

tickets = [ticket_1, ticket_2, ticket_3]

print(reconstruct_trip(tickets, len(tickets)))

print("*** Test 2 ***")
ticket_1 = Ticket("PIT", "ORD")
ticket_2 = Ticket("XNA", "SAP")
ticket_3 = Ticket("SFO", "BHM")
ticket_4 = Ticket("FLG", "XNA")
ticket_5 = Ticket("NONE", "LAX")
ticket_6 = Ticket("LAX", "SFO")
ticket_7 = Ticket("SAP", "SLC")
ticket_8 = Ticket("ORD", "NONE")
ticket_9 = Ticket("SLC", "PIT")
ticket_10 = Ticket("BHM", "FLG")

tickets = [ticket_1, ticket_2, ticket_3, ticket_4, ticket_5,
           ticket_6, ticket_7, ticket_8, ticket_9, ticket_10]

print(reconstruct_trip(tickets, len(tickets)))
