#include <bits/stdc++.h>
using namespace std;
int main(){
// #ifndef TESTING
// freopen("input.txt", "r", stdin);
// freopen("output.txt", "w", stdout);
// #endif
int houseNum = 0;
int xSize, ySize;
cin >> xSize >> ySize;
do{
char house[ySize][xSize];
pair<int, int> pos;
int direction;
for(int i = 0; i < ySize; i++){
string line;
cin >> line;
for(int j = 0; j < line.size(); j++){
char c = line.at(j);
house[i][j] = c;
if(c == '*'){
pos.first = i;
pos.second = j;
if(i == 0){
direction = 2;
} else if(i == ySize - 1){
direction = 0;
} else if(j == 0){
direction = 1;
} else {
direction = 3;
}
}
}
}
while(house[pos.first][pos.second] != 'x'){
if(house[pos.first][pos.second] == '/'){
switch(direction){
case 0:
direction = 1;
break;
case 1:
direction = 0;
break;
case 2:
direction = 3;
break;
case 3:
direction = 2;
break;
default:
break;
}
} else if(house[pos.first][pos.second] == '\\'){
switch(direction){
case 0:
direction = 3;
break;
case 1:
direction = 2;
break;
case 2:
direction = 1;
break;
case 3:
direction = 0;
break;
default:
break;
}
}
switch(direction){
case 0:
pos.first--;
break;
case 1:
pos.second++;
break;
case 2:
pos.first++;
break;
case 3:
pos.second--;
break;
default:
break;
}
}
house[pos.first][pos.second] = '&';
cout << "HOUSE " << ++houseNum << endl;
for(int i = 0; i < ySize; i++){
for(int j = 0; j < xSize; j++){
cout << house[i][j];
}
cout << endl;
}
cin >> xSize >> ySize;
} while(xSize > 0);
return 0;
}