var i,j,k,l,m,n,p,q,r,s,t,x1,x2,y1,y2:longint;
can,sel,v:array[0..8,0..8] of boolean;
short,len:array[1..7,1..7] of longint;
quene:array[1..100,1..2] of longint;
c:char;
pd:boolean;
procedure dfs(x,y,deep:longint);
var g:longint;
begin
if (x=x2)and(y=y2) then
begin
if deep=t then pd:=true;
exit;
end;
can[x,y]:=false;
if can[x-1,y] then
dfs(x-1,y,deep+1);
if pd then
begin
can[x,y]:=true;exit;
end;
if can[x+1,y] then
dfs(x+1,y,deep+1);
if pd then
begin
can[x,y]:=true;exit;
end;
if can[x,y-1] then
dfs(x,y-1,deep+1);
if pd then
begin
can[x,y]:=true;exit;
end;
if can[x,y+1] then
dfs(x,y+1,deep+1);
can[x,y]:=true;
end;
begin
while true do
begin
readln(n,m,t);
if n+m+t=0 then halt;
fillchar(can,sizeof(can),true);
for i:=1 to n do
begin
can[i,0]:=false;can[i,m+1]:=false;
end;
for i:=1 to m do
begin
can[0,i]:=false;can[n+1,i]:=false;
end;
x1:=1;y1:=1;
for i:=1 to n do
begin
for j:=1 to m do
begin
read©;
if c='D' then begin x2:=i;y2:=j;end;
if c='H' then can[i,j]:=false;
end;
readln;
end;
if abs(x1-x2+y1-y2+t) mod 2=1 then
begin
writeln('No');
continue;
end;
pd:=false;
if can[x1-1,y1] then dfs(x1-1,y1,1);
if pd then
begin
writeln('Yes');
continue;
end;
if can[x1+1,y1] then dfs(x1+1,y1,1);
if pd then
begin
writeln('Yes');
continue;
end;
if can[x1,y1-1] then dfs(x1,y1-1,1);
if pd then
begin
writeln('Yes');
continue;
end;
if can[x1,y1+1] then dfs(x1,y1+1,1);
if pd then writeln('Yes') else writeln('No');
end;
end.
can,sel,v:array[0..8,0..8] of boolean;
short,len:array[1..7,1..7] of longint;
quene:array[1..100,1..2] of longint;
c:char;
pd:boolean;
procedure dfs(x,y,deep:longint);
var g:longint;
begin
if (x=x2)and(y=y2) then
begin
if deep=t then pd:=true;
exit;
end;
can[x,y]:=false;
if can[x-1,y] then
dfs(x-1,y,deep+1);
if pd then
begin
can[x,y]:=true;exit;
end;
if can[x+1,y] then
dfs(x+1,y,deep+1);
if pd then
begin
can[x,y]:=true;exit;
end;
if can[x,y-1] then
dfs(x,y-1,deep+1);
if pd then
begin
can[x,y]:=true;exit;
end;
if can[x,y+1] then
dfs(x,y+1,deep+1);
can[x,y]:=true;
end;
begin
while true do
begin
readln(n,m,t);
if n+m+t=0 then halt;
fillchar(can,sizeof(can),true);
for i:=1 to n do
begin
can[i,0]:=false;can[i,m+1]:=false;
end;
for i:=1 to m do
begin
can[0,i]:=false;can[n+1,i]:=false;
end;
x1:=1;y1:=1;
for i:=1 to n do
begin
for j:=1 to m do
begin
read©;
if c='D' then begin x2:=i;y2:=j;end;
if c='H' then can[i,j]:=false;
end;
readln;
end;
if abs(x1-x2+y1-y2+t) mod 2=1 then
begin
writeln('No');
continue;
end;
pd:=false;
if can[x1-1,y1] then dfs(x1-1,y1,1);
if pd then
begin
writeln('Yes');
continue;
end;
if can[x1+1,y1] then dfs(x1+1,y1,1);
if pd then
begin
writeln('Yes');
continue;
end;
if can[x1,y1-1] then dfs(x1,y1-1,1);
if pd then
begin
writeln('Yes');
continue;
end;
if can[x1,y1+1] then dfs(x1,y1+1,1);
if pd then writeln('Yes') else writeln('No');
end;
end.