#!/usr/bin/python3

import sys
import random

NW='\\'
NE='/'

L = []

Width=-1
for line in sys.stdin:
    sys.stdout.write(line)
    line = line.strip()
    L.append(line)
    if Width == -1:
        Width = len(line)
    elif Width != len(line):
        sys.stdout.write(' bad line length!\n')

Height = len(L)

WalkRules = { 'S' : { NE : 'W', NW : 'E' },
              'N' : { NE : 'E', NW : 'W' },
              'E' : { NE : 'N', NW : 'S' },
              'W' : { NE : 'S', NW : 'N' } }

for x in range(0,Width):
    y = 0
    dir = 'S'
    path=[(x,y)]
    while x >= 0 and x < Width and y >= 0 and y < Height:
        wall = L[y][x]
        dir = WalkRules[dir][wall]
        if dir == 'N':
            y = y - 1
        elif dir == 'S':
            y = y + 1
        elif dir == 'E':
            x = x + 1
        elif dir == 'W':
            x = x - 1
        path.append((x,y))
    if (y == Height):
        break;

if (y == Height):
    sys.stdout.write('Solution:\n')
    for j in range(0, Height):
        for i in range(0, Width):
            if (i,j) in path:
                sys.stdout.write(L[j][i])
            else:
                sys.stdout.write(' ')
        sys.stdout.write('\n')
else:
    sys.stdout.write('No solution!\n')

