Puzzle From the Future

CodeForces - 1474A