solved 12, 13 in python