def parse_input(spreadsheet):
    """For a 'spreadsheet' of the following layout

    5 1 9 5
    7 5 3
    2 4 6 81

    return a generator of lists of ints
    """
    #Turn the sheet into a generator of lists of numbers
    sheet = ([int(cell.strip()) for cell in row.split()]
             for row in spreadsheet.splitlines())
    return sheet