Given a square matrix of size `N x N` represented as a list of lists, where each cell contains a specific cost, find the path from the top-left cell to the bottom-right cell that has the maximum average cost. You can only move right or down at each step. The average is computed as the total cost of the path divided by the number of cells visited.
#### Example
```python [main.nopy]
matrix = [
[1, 2, 3],
[6, 5, 4],
[7, 3, 9]
]
result = max_average_path(matrix)
print(result) # Output: 5.2
```
#### Constraints
- The matrix will always be square (N x N) with `N >= 1`.
- All elements in the matrix are integers.
Write a function `max_average_path(matrix)` that returns the maximum average of any valid path.