Rooks#5481

Rooks

2 seconds
256 megabytes
Very hard

You are given a chessboard of size N \times N with rooks placed on it.

Your task is to color the rooks using the minimum number of colors so that no two rooks of the same color are in the same row or column.

Input

The first line contains the integer (1 \leq N \leq 100). The next lines describe the chessboard as an N \times N matrix. An empty square is represented by the symbol '.', and a square with a rook is represented by the symbol '*'. There are no spaces between symbols in a single line.

Output

In the first line, output — the minimum number of colors needed. In the following lines, output the chessboard, where an empty square is represented by the number , and a rook colored with color number is represented by the number .

Examples

Example 1

Loading
Loading