Wiring help with ceiling fan
It would be helpful to know what devices were powered by the black / yellow / red wires.  Providing more information will make it easier for others to help you.  It would also be helpful to know if you are working in a 120V environment (USA) or 240V environment.

I would attempt to identify the hot and neutral wires with a volt meter.  This is the minimum.  If you do not have experience working with volt meters, I suggest that you find someone that does to help and provide safety guidance.

It would not surprise me if the red and black potential difference was 120V (assuming you are in the USA).  Drawing a diagram is helpful to understanding the wiring system.