When i submitted my solution, the judge throws me Runtime Error on test 8, more specifically with this test:
10 10
.........*
.........*
........**
.........*
.........*
.........*
.........*
.........*
.........*
.........*
But i ran the program with this test in my computer and it works correctly and the output is correct:
YES
3 10