Arduino Resetting Itself with Relay

Hello I am also looking for some help on this. My setup is a little different. I’m using two relays to alter the direction of a dc motor. I aswell get the Arduino resetting when turning off relay. See photo for how the relays are withered up. I am just looking for help on where to put the Diode on my set up. Any and all help is welcome.