I know that i wrote a spaghetti code but, i didn't understand how to resolve. Thanks for help.