SIGSEV error in GERALD08.

This is my submission of GERALD08 http://www.codechef.com/viewsolution/3773036 , 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?

//