Desktop PC problem while starting

For some reason, my personal desktop is creating problems.That is, when I turn it on, it works fine but after sometime it does not take any input from the mouse and keyboard. Sometimes it works and sometimes it does not. Can anyone tell me what I should do with this??
