ImperturbableHalfHellbender

# Edit these two values.  Enter data by columns, top to bottom, left to right
INFLUX = 590
arr = [[650,460,590,-520,-640],[360,400,420,-340,-420],[270,310,180,-260,-330],[130,60,210,-70,-130],[40,30,30,-40,-10]]
# ^ represents an influx of 590 and this
#   array of capacitance/resistance: 650  360  270  130  40
#                                    460  400  310   60  30
#                                    590  420  180  210  30
#                                   -520 -340 -260  -70 -40
#                                   -640 -420 -330 -130 -10
# You most likely don't need to edit anything under this line.

# If you can't find a solution, you may need to change the target total, which
# was 730 for most people.  The overall goal is for you and your fireteam to have
# the same sum after selecting your nodes, so try different values here.
TARGET_TOTAL = 730





# Code below.  Don't touch
TARGET = TARGET_TOTAL-INFLUX
def visit(total, chosen, rest, target, depth):
        if depth == 5:
                if total == target:
                        print(chosen)
                        return True
                return False
        picks = rest[0]
        for pick in picks:
                res = visit(total+pick, chosen+[pick], rest[1:], target, depth+1)
                if res:
                        return True

first = arr[0]
for pick in first:
        res = visit(pick, [pick], arr[1:], TARGET, 1)
        if res:
                break