Input: I AM GOING TO TEMPLE FROM MADURAI
I AM GOING TO BEACH FROM MADURAI

Output: second