Bob is a farmer. He has a large pasture with many sheep. Recently, he has lost some of them due to wolf attacks. He thus decided to place some shepherd dogs in such a way that all his sheep are protected.

The pasture is a rectangle consisting of R × C cells. Each cell is either empty, contains a sheep, a wolf or a dog. Sheep and dogs always stay in place, but wolves can roam freely around the pasture, by repeatedly moving to the left, right, up or down to a neighboring cell. When a wolf enters a cell with a sheep, it consumes it. However, no wolf can enter a cell with a dog.

Initially there are no dogs. Place dogs onto the pasture in such a way that no wolf can reach any sheep, or determine that it is impossible. Note that since you have many dogs, you do not need to minimize their number. 


-----Input-----

First line contains two integers R (1 ≤ R ≤ 500) and C (1 ≤ C ≤ 500), denoting the number of rows and the numbers of columns respectively.

Each of the following R lines is a string consisting of exactly C characters, representing one row of the pasture. Here, 'S' means a sheep, 'W' a wolf and '.' an empty cell.


-----Output-----

If it is impossible to protect all sheep, output a single line with the word "No".

Otherwise, output a line with the word "Yes". Then print R lines, representing the pasture after placing dogs. Again, 'S' means a sheep, 'W' a wolf, 'D' is a dog and '.' an empty space. You are not allowed to move, remove or add a sheep or a wolf.

If there are multiple solutions, you may print any of them. You don't have to minimize the number of dogs.


-----Examples-----
Input
6 6
..S...
..S.W.
.S....
..W...
...W..
......

Output
Yes
..SD..
..SDW.
.SD...
.DW...
DD.W..
......

Input
1 2
SW

Output
No

Input
5 5
.S...
...S.
S....
...S.
.S...

Output
Yes
.S...
...S.
S.D..
...S.
.S...



-----Note-----

In the first example, we can split the pasture into two halves, one containing wolves and one containing sheep. Note that the sheep at (2,1) is safe, as wolves cannot move diagonally.

In the second example, there are no empty spots to put dogs that would guard the lone sheep.

In the third example, there are no wolves, so the task is very easy. We put a dog in the center to observe the peacefulness of the meadow, but the solution would be correct even without him.

Difficulty: interview

Starter code:

Solutions:
r, c = list(map(int, input().split()))
ls = [[c for c in input()] for i in range(r)]
for i in range(r):
    dead = False
    for j in range(c):
        if ls[i][j] == 'W':
            if i != 0 and ls[i - 1][j] == 'S': dead = True
            if i != r - 1 and ls[i + 1][j] == 'S': dead = True
            if j != 0 and ls[i][j - 1] == 'S': dead = True
            if j != c - 1 and ls[i][j + 1] == 'S': dead = True
            if dead: 
                break
        elif ls[i][j] == '.':
            ls[i][j] = 'D'
    if dead:
        print("No")
        break
else:
    print("Yes")
    for i in range(r):
        print(''.join(ls[i]))



r,c = (int(x) for x in input().split())

g = []
for i in range(r):
    g.append(input())

# res = True

def fn():
    # nonlocal res
    for rr in range(r):
        for cc in range(c):
            if g[rr][cc] != 'W':
                continue
            if cc > 0 and g[rr][cc-1] == 'S':
                # res = False
                return False
            if cc < c-1 and g[rr][cc+1] == 'S':
                return False
            if rr > 0 and g[rr-1][cc] == 'S':
                return False
            if rr < r-1 and g[rr+1][cc] == 'S':
                return False
    return True

res = fn()
if not res:
    print('No')
else:
    print('Yes')
    for row in g:
        print(row.replace('.', 'D'))


import sys

s = input().split()
r,c = list(map(int, s))
f = ['']*r
for x in range(r):
    f[x] = input().replace('.', 'D')
    if 'WS' in f[x] or 'SW' in f[x]:
        print('No')
        return
    if x > 0:
        for y in range(c):
            up = f[x][y]+f[x-1][y]
            if up in ['SW', 'WS']:
                print('No')
                return
print('Yes')
for x in range(r):
    print(f[x])


def A():
    R,C = map(int, input().split())
    pasture = []
    for _ in range(R):
        line = input().replace('.','D')
        if 'WS' in line or 'SW' in line:
            return False
        pasture.append(line)

    #Check columns
    for i in range(C):
        column = ''.join([l[i] for l in pasture])
        if 'WS' in column or 'SW' in column:
            return False

    #Here it is ok
    return '\n'.join(pasture)

res = A()
if res:
    print('Yes')
    print(res)
else:
    print('No')

r, c = list(map(int, input().split()))
cells = [list(input()) for _ in range(r)]

ans = "Yes"
for i in range(r):
    for j in range(c):
        if cells[i][j] == '.':
            cells[i][j] = 'D'
for i in range(r - 1):
    for j in range(c):
        if cells[i][j] == 'S' and cells[i + 1][j] == 'W':
            ans = "No"
        if cells[i][j] == 'W' and cells[i + 1][j] == 'S':
            ans = "No"
for i in range(r):
    for j in range(c - 1):
        if cells[i][j] == 'S' and cells[i][j + 1] == 'W':
            ans = "No"
        if cells[i][j] == 'W' and cells[i][j + 1] == 'S':
            ans = "No"
print(ans)
if ans == "Yes":
    for i in range(r):
        print(''.join(cells[i]))


#!/usr/bin/env python3

import sys

[R, C] = list(map(int, sys.stdin.readline().strip().split()))
field = [sys.stdin.readline().strip() for _ in range(R)]

for line in field:
	if ('WS' in line) or ('SW' in line):
		print ('No')
		return
for l1, l2 in zip(field[1:], field[:-1]):
	for c1, c2 in zip(l1, l2):
		if (c1 == 'W' and c2 == 'S') or (c1 == 'S' and c2 == 'W'):
			print ('No')
			return

for i in range(R):
	field[i] = field[i].replace('.', 'D')

print ('Yes')
for line in field:
	print (line)


R, C = list(map(int, input().split()))
r = []
f = 0
for i in range(R):
    r.append(input())
    for j in range(C):
        if r[i][j] == 'W':
            if j and r[i][j - 1] == 'S':
                f = 1
                break
            if j + 1 < C and r[i][j + 1] == 'S':
                f = 1
                break
    if f:
        break
if not f:
    for i in range(C):
        for j in range(R):
            if r[j][i] == 'W':
                if j and r[j - 1][i] == 'S':
                    f = 1
                    break
                if j + 1 < R and r[j + 1][i] == 'S':
                    f = 1
                    break
        if f:
            break
if f:
    print('No')
else:
    print('Yes')
    for i in range(R):
        print(r[i].replace('.','D'))



R,C = list(map(int , input().split()))
prev = input().replace('.', 'D')

res  = [prev]
for cnt in range(C-1):
    if (prev[cnt] == 'W' and prev[cnt+1] == 'S') or (prev[cnt] == 'S' and prev[cnt+1] == 'W'):
        print('No')
        return
for row in range(R-1):
    cur = input().replace('.', 'D')
    res.append(cur)
    if C==1 :
        if (prev[0] == 'W' and cur[0] == 'S') or (prev[0] == 'S' and cur[0] == 'W'):
            print('No')
            return

    for cnt in range(C-1):
        if (cur[cnt] == 'W' and cur[cnt+1] == 'S') or (cur[cnt] == 'S' and cur[cnt+1] == 'W'):
            print('No')
            return


    for cnt in range(C):
        if (prev[cnt] == 'W' and cur[cnt] == 'S') or (prev[cnt] == 'S' and cur[cnt] == 'W'):
            print('No')
            return

    prev = cur

print('Yes')
for c in res:
    print(c)



r, c = map(int, input().split())
num = [[1] * (c + 2)]
for i in range(r):
    s = input()
    ans = [1]
    for j in range(len(s)):
        if s[j] == '.':
            ans.append('D')
        else:
            ans.append(s[j])
    ans.append(1)
    num.append(ans)
num.append([1] * (c + 2))
fl = True
for i in range(1, len(num) - 1):
    for j in range(1, len(num[i]) - 1):
        if num[i][j] == 'S' and (num[i][j - 1]== 'W' or num[i][j + 1]== 'W' or num[i - 1][j]== 'W' or num[i + 1][j]== 'W'):
            fl = False
if fl:
    print('Yes')
    for i in range(1, len(num) - 1):
        for j in range(1, len(num[i]) - 1):
            print(num[i][j], end='')
        print()
else:
    print('No')

r, c = [int(x) for x in input().split()]
table = [[c for c in input()] for i in range(r)]

def check(i, j):
    if i > 0:
        if table[i-1][j] == 'W':
            return False
    if i < r - 1:
        if table[i+1][j] == 'W':
            return False
    if j > 0:
        if table[i][j-1] == 'W':
            return False
    if j < c - 1:
        if table[i][j+1] == 'W':
            return False
    return True
    
no = False

for i in range(r):
    for j in range(c):
        if (table[i][j] == 'S') and check(i,j) is False:
            print('No')
            no = True
            break
    if no:
        break

if not no:
    print('Yes')
    for i in range(r):
        s = ""
        for j in range(c):
            s += ('D' if table[i][j] == '.' else table[i][j])
        print(s)


R, C = list(map(int, input().split()))
field = []
for i in range(R):
    line = input()
    f = []
    for ch in line:
        f.append(ch)
    field.append(f)

lu = [[1, 0], [-1, 0], [0, 1], [0, -1]]
def main():
    for i in range(R):
        for j in range(C):
            item = field[i][j]
            if item == '.':
                field[i][j] = 'D'
            if item == 'S':
                for [di, dj] in lu:
                    di += i; dj += j
                    if di in range(R) and dj in range(C):
                        if field[di][dj] == 'W':
                            print('No')
                            return

    print('Yes')
    for line in field:
        print(''.join(line))

main()