Well, that's good. I mean, narrows things down even more so makes it a lot more likely it's as we thought and probably MB or CPU.
As to the cooler, the 5600G comes with it's own cooler, but it's not a great option. It will keep the CPU from "overheating" but it is annoying, ramping up and down with regularity, and not allowing for as good of boost performance or boosting as long as with a better cooler.
What cooler do you have now because most cooler manufacturers will ship you an updated cooler bracket and backplate assembly if you have one of their coolers and the original purchase documentation or if you had registered it with them, for free. Otherwise, this would be a very good, inexpensive, but very well performing option. No other cooler under 30 bucks is going to perform as well and most of the ones under 40 probably won't either.
PCPartPicker Part List
CPU Cooler: Thermalright Assassin X Refined SE ARGB 66.17 CFM CPU Cooler ($22.90 @ Amazon)
Total: $22.90
Prices include shipping, taxes, and discounts when available
Generated by PCPartPicker 2022-11-21 13:27 EST-0500
If you want something that is budget friendly but offers even more performance than that one, there is also this, that offers super terrific performance, punching up into the the kind of performance you'd expect to only get from a much larger dual 140mm finstack cooler.
https://www.amazon.com/Thermalright...-1-spons&sp_csd=d2lkZ2V0TmFtZT1zcF9hdGY&psc=1