Implement a Paint class that initializes a board of size m x n and supports methods to print the grid, draw a cell with a given color, undo the previous action, and redo the undone action.
Asked in the technical phone screen stage. Implement the board and history behavior using Python.
Use paint(m, n, operations). Each operation is a dictionary: {"op": "draw", "row": r, "col": c, "color": color}, {"op": "undo"}, {"op": "redo"}, or {"op": "print"}. Return a list containing the grid produced by each print operation. Empty cells contain ".". A new draw after an undo clears the redo history.
def paint(m, n, operations):