Based on CD4017 and logic gates this electronic circuit switches on a relay if you press four keys in the correct sequence, and backs to the start condition by pressing any key. Once the circuit is supplied the first output of the counter is on and sends the high signal to one input of the CD4081 first gate.
By pressing the correct key (P1) the other input of that gate gets on. So pin 3 of the CD4081, then pin 1 of the CD4072 turns on the clock relay K1. The capacitor keeps on the relay for about 0,5 seconds and the key should not be pressed for a longer time.
When all keys are pressed in the correct order the relay K3 turns on. If you press a wrong key the inputs of the related EXOR gate of the CD4030 get a different signal, then the output turns on the reset relay K2 by pin 13 of the CD4072.