Python bruteforce solver