SIGSEV error in GERALD08.

This is my submission of GERALD08 CodeChef: Practical coding for everyone , its running correct in my test cases but giving RE.
Is it because my recursive dfs or something else.Can you pl tell why its giving RE?