
def euler_062():
    solutions = {}
    for n in range(1, 10000):
        cube = n * n * n
        try:
            key = "".join(sorted(str(cube)))
            solutions[key].append(cube)
            if len(solutions[key]) > 4:
                # print(solutions[key])
                s = solutions[key][0]
                break
        except KeyError:
            solutions[key] = [cube]
    return s


if __name__ == "__main__":
    print("e062.py: " + str(euler_062()))
    assert(euler_062() == 127035954683)
