SPOJ Aliens at the subway problem

Hi All,
I was trying to solve the following bfs question from SPOJ -
https://www.spoj.com/problems/ALIEN3/ and link to my solution is https://ideone.com/dtVcsC
. I am trying BFS + bitmask approach , but unable to find the mistake in my solution . If anyone can give me solution to this problem or find error in my code , will be very helpful .

Thank you.

//