Descriptions:

Neko and Flashback

CodeForces - 1152E