The official statement of a problem is always the one
in the PDF document. The HTML version of the statement
is also given to help you, but may contain some content
that is not well displayed. In case of doubt, always use the PDF.
Public test cases
Input
HELLO
3
A O L
D E L
G H I
Output
The word HELLO can be composed following the path: (2,1), (1,1), (1,2), (0,2) and (0,1).
Input
HELLO
3
A O L
D E L
G H I
Output
The word HELLO can be composed following the path: (2,1), (1,1), (1,2), (0,2) and (0,1).