Solved problem67 in python3