#include using namespace std; typedef long long ll; typedef pair< int, int > pii; typedef vector< int > vi; typedef vector< vi > vvi; typedef vector< ll > vl; typedef vector< vl > vvl; typedef vector< pii > vp; typedef vector< vp > vvp; typedef vector< string > vs; typedef vector< double > vd; typedef vector< vd > vvd; template< class T1, class T2 > int upmin( T1 &x, T2 v ){ if( x > v ){ x = v; return 1; } return 0; } template< class T1, class T2 > int upmax( T1 &x, T2 v ){ if( x < v ){ x = v; return 1; } return 0; } const int INF = 0x3f3f3f3f; int H, W; vs G; void init(){ cin >> H >> W; G = vs( H ); for( int i = 0; i < H; ++i ) cin >> G[ i ]; } vp pnt; void preprocess(){ for( int i = 0; i < H; ++i ) for( int j = 0; j < W; ++j ) if( G[ i ][ j ] == '*' ) pnt.emplace_back( i, j ); } int ok( pii a, pii b, pii c ){ int dx1 = b.first - a.first; int dy1 = b.second - a.second; int dx2 = c.first - b.first; int dy2 = c.second - b.second; int g1 = __gcd( dx1, dy1 ); int g2 = __gcd( dx2, dy2 ); dx1 /= g1, dy1 /= g1; if( dx1 < 0 ) dx1 *= -1, dy1 *= -1; dx2 /= g2, dy2 /= g2; if( dx2 < 0 ) dx2 *= -1, dy2 *= -1; return not ( dx1 == dx2 and dy1 == dy2 ); } void solve(){ for( int i = 0; i < H; ++i ) for( int j = 0; j < W; ++j ) if( G[ i ][ j ] != '*' ) if( ok( pnt[ 0 ], pnt[ 1 ], make_pair( i, j ) ) ){ G[ i ][ j ] = '*'; for( int x = 0; x < H; ++x, cout << endl ) for( int y = 0; y < W; ++y ) cout << G[ x ][ y ]; exit( 0 ); } } signed main(){ ios::sync_with_stdio( 0 ); init(); preprocess(); solve(); return 0; }