uses
  crt;
var
  doska,prior:array[1..4,1..4] of byte;

procedure input;
var
  i,j:byte;
  s,s1,filename:string;
  f:text;
  code:integer;
  sim:array[1..16] of string[5];
begin
  if paramcount=0 then
    begin
      writeln('Not enouf parametrs!!! Program halted!!!');
      halt;
    end;
  for i:=1 to paramcount do
    begin
      s:=paramstr(i);
      if s[1]<>'-' then filename:=s;
    end;
  {----------------- reading file -------------------------}
  fillchar(doska,sizeof(doska),0);
  assign(f,filename); reset(f);
  s:='';
  while not(eof(f)) do begin readln(f,s1); s:=s+s1+' '; end;
  while pos('  ',s)<>0 do delete(s,pos('  ',s),1);
  close(f);
  for i:=1 to 4 do
    for j:=1 to 4 do
      begin
        s1:=copy(s,1,pos(' ',s)-1);
        delete(s,1,pos(' ',s));
        if not((s1='x') or (s1='X')) then val(s1,doska[i,j],code);
      end;
end;

procedure out(s:string);
var i:byte;
begin
  for i:=1 to length(s) do
    case s[i] of
      'U':write('UP ');
      'D':write('DOWN ');
      'L':write('LEFT ');
      'R':write('RIGHT ');
    end;
end;

procedure move_x(ax,ay,bx,by:byte);
var k,i,j,tx,ty:byte; s:string;
begin
  if (ax=bx) and (ay=by) then exit; prior[ax,ay]:=9;
  k:=10;
  if (ax<>1) and (prior[ax-1,ay]=0) then prior[ax-1,ay]:=k;
  if (ax<>4) and (prior[ax+1,ay]=0) then prior[ax+1,ay]:=k;
  if (ay<>1) and (prior[ax,ay-1]=0) then prior[ax,ay-1]:=k;
  if (ay<>4) and (prior[ax,ay+1]=0) then prior[ax,ay+1]:=k;
  while prior[bx,by]=0 do
    begin
      k:=k+1;
      for i:=1 to 4 do
        for j:=1 to 4 do
          if prior[i,j]=k-1 then
            begin
              if (i<>1) and (prior[i-1,j]=0) then prior[i-1,j]:=k;
              if (i<>4) and (prior[i+1,j]=0) then prior[i+1,j]:=k;
              if (j<>1) and (prior[i,j-1]=0) then prior[i,j-1]:=k;
              if (j<>4) and (prior[i,j+1]=0) then prior[i,j+1]:=k;
            end;
    end;
  s:=''; tx:=bx; ty:=by; k:=prior[tx,ty];
  while k<>9 do
    begin
      k:=prior[tx,ty]-1;
      if (tx<>1) and (prior[tx-1,ty]=k) then begin tx:=tx-1; s:='D'+s; continue; end;
      if (tx<>4) and (prior[tx+1,ty]=k) then begin tx:=tx+1; s:='U'+s; continue; end;
      if (ty<>1) and (prior[tx,ty-1]=k) then begin ty:=ty-1; s:='R'+s; continue; end;
      if (ty<>4) and (prior[tx,ty+1]=k) then begin ty:=ty+1; s:='L'+s; continue; end;
    end;
  for i:=1 to length(s) do
    case s[i] of
      'U':begin doska[ax,ay]:=doska[ax-1,ay]; ax:=ax-1; doska[ax,ay]:=0; end;
      'D':begin doska[ax,ay]:=doska[ax+1,ay]; ax:=ax+1; doska[ax,ay]:=0; end;
      'L':begin doska[ax,ay]:=doska[ax,ay-1]; ay:=ay-1; doska[ax,ay]:=0; end;
      'R':begin doska[ax,ay]:=doska[ax,ay+1]; ay:=ay+1; doska[ax,ay]:=0; end;
    end;
  out(s);
end;

procedure fill_prior(num:byte);
var i:byte;
begin
  for i:=1 to num-1 do prior[(i-1) div 4+1,(i-1) mod 4+1]:=1;
  for i:=num to 16 do prior[(i-1) div 4+1,(i-1) mod 4+1]:=0;
end;

procedure doing;
label l1;
var
  dvig,dx,dy,d1x,d1y,xx,xy,i,j,temp:byte;
begin
  clrscr;
  fillchar(prior,sizeof(prior),0);
  for i:=1 to 4 do
    for j:=1 to 4 do
      if doska[i,j]=0 then
        begin xx:=i; xy:=j; end;
  for dvig:=1 to 13 do
    begin
      for i:=1 to 4 do
        for j:=1 to 4 do
          if doska[i,j]=dvig then
            begin dx:=i; dy:=j; end;
      d1x:=(dvig-1) div 4+1; d1y:=(dvig-1) mod 4+1;
      if (dx=d1x) and (dy=d1y) then
        begin {writeln(dvig,' on the need place!!!');} continue; end;
      {------------ move only 4,8,12 ---------------}
      if not(dvig in [4,8,12]) then goto l1;

      if (xx=dx-1) and (xy=dy) then
        begin
          doska[xx,xy]:=doska[dx,dy]; xx:=xx+1; doska[xx,xy]:=0;
          out('U');
          {writeln(dvig,' on the need place!!!');}
          continue;
        end;
      move_x(xx,xy,dx,1); xx:=dx; xy:=1;
      out('URRRDLULLD');
      temp:=doska[dx,4]; doska[dx,4]:=doska[dx,3]; doska[dx,3]:=doska[dx-1,4]; doska[dx-1,4]:=temp;
      {writeln(dvig,' on the need place!!!');}
      continue;
      {------------ move only one number -----------}
       l1: if dvig=13 then
         begin
           halt;
         end;
      fill_prior(dvig);  prior[dx,dy]:=1;
      while dy>d1y do
        begin
          move_x(xx,xy,dx,dy-1); xy:=dy-1; xx:=dx;
          doska[xx,xy]:=dvig; doska[dx,dy]:=0;
          fill_prior(dvig);
          xy:=xy+1; dy:=dy-1; prior[dx,dy]:=1;
          out('R');
        end;
      while dx>d1x do
        begin
          move_x(xx,xy,dx-1,dy); xx:=dx-1; xy:=dy;
          doska[xx,xy]:=dvig; doska[dx,dy]:=0;
          fill_prior(dvig);
          xx:=xx+1; dx:=dx-1; prior[dx,dy]:=1;
          out('D');
        end;
      {writeln(dvig,' on the need place!!!');}
    end;
  {writeln('Program ended work!!! See result!!!');}
end;

begin
  input;
  doing;
end.