Sadistic Solution is following