From a matrix, print the path to find the given word