This was coded by me and @ravindar26 for the event Code Obfusction which was in IIT-M.