How to create cirular linked list while taking input?

qn:https://hack.codingblocks.com/contests/c/511/471