def knapsack():

    capacity = 41

    matrix = [(1, 12.34, 123.99),(2, 23.45, 600.54),(3, 12.78, 90.67), (4, 9.34, 45.32)]

    matrix = sorted(matrix, key=lambda object: object[1]/object[2])

    i = 0

    while capacity > 0:

        if capacity > matrix[i][1]:
            capacity -= matrix[i][1]
            i+=1
        else:
            capacity = -capacity

    output = ""

    for k in range(0, i):

        output += str(matrix[k][0]) + " "+ str(matrix[k][1]) + " " + str(matrix[k][2]) + " complete"

    if capacity < 0:
        
        output += str(matrix[i][0]) + " "+ str(matrix[i][1]) + " " + str(matrix[i][2]) + " "+ str(capacity) + "fractional"
        
    print(output)        

knapsack()        
