Confirm the CPU cooler fan is connected to the CPU_Fan header correctly. Remove and reseat to be sure. It's close to the RAM DIMM sockets and could potentially be disturbed when removing the DIMMs.
Remove the RAM DIMMs again and check the DIMM sockets for all dust or crap. Ensure the DIMMs are free from dust and crap and then reseat, one at a time.
If reboots continue, do the following:
Fit one DIMM to DDR3/DDR4 Slot 1/A and then boot. Do this step for each DIMM of RAM, one at a time.
If they all work individually, add a second DIMM to slot 2/B and then test. Remove and replace with two remaining (if your using four).
If they all work, fit all of them back in and then boot the computer and test.
To be extra certain, download the memtest ISO image, burn it to disc or to Memory stick and then boot the computer from it. Run at least 7 full passes - it shouldn't error at all. If it manages 7 passes without error its safe to continue using.