class Pair:
    def __init__(self, word, num):
        # first is a word, second a number
        self.wordPart = word
        self.numPart = num

    def __lt__(self, x):
        return self.wordPart < x.wordPart
    
    def __str__(self):
        return "<%s, %d>"%(self.wordPart, self.numPart)

def main():
    L = []
    L.append( Pair( "bob", 23) )
    L.append( Pair( "hermione", 8))
    L.append( Pair( "dumbledore", 185))
    L.append( Pair( "matt damon", 12))
    L.sort()
    for x in L:
        print( x, end= " " )
    print()

    A = Pair( "Villanova", 77)
    B = Pair( "UNC", 74)
    if A < B:
        print( A )
    else:
        print( B )

main()

    
