Program game;
type x = array[1.. 16] of integer;
var x111,x112,x113,x114,x21,x22,x23,x24,x31,x32,x33,x34,x41,x42,x43,x44: integer;
    {so they caqn differ from x's in type declaration}
    pr,t:integer;
  { type
   X2 = array [1 .. 4] of integer;
   X3 = array [1 .. 4] of integer;
    X4 = array [1 .. 4] of integer;}

Function Find(fi : integer):integer ;
   var l:integer;
  begin

  for pr:=1 to 16 do
                  begin
                 { l:=x(pr);
                  if fi=l then find:=pr;}
                  end;

  end;
Procedure Show{(Show:integer)};
          Var p:integer;
          begin
          for p:= 1 to 4 do begin
                            Writeln(X111, x112, x113, x114);
                            Writeln(X21,x22,x23,x24);
                            Writeln(X31,x32,x33,x34);
                            Writeln(X41,x42,x43,x44);
                            end;
          end;
procedure Move(who,Where:integer);
        begin

        end;
{Procedure Left(left:integer);
          Var pr:integer;
          begin
         { for pr:=1 to 4 do
                          begin
                          if x1(pr):=0 then goto end;
                          if x2(pr):=0 then goto end;
                          if x3(pr):=0 then goto end;
                          if x4(pr):=0 then goto end;

                          end;
          left:=X1(
          pr:=x1(left);
          x(1):=left;
          X(left):=pr
          end;}
Procedure moveleft(x:integer);
         var p:integer;

         Begin
         {label nd;}
         if (x=X111) or (x=x21) or (x=X31) or (x=x41) then {goto end;
         nd :} writeln('unpossible movement');

         end;

Procedure lastDown(Ld:integer);{to fit "4" and "8" }
      begin
      pr:=find(ld);
      if ld=4 then begin

                   {move(x(pr),x23){only in line 2,3 and 4}
                  { movehole(x22);
                   movedown(x112);
                   moveleft(x113);
                   moveup(x23);
                   moveleft(x24);
                   movedown(x114);
                   moveright(x113);
                   moveleft(x112);
                   moveup(x22)
                   end;
       if ld=8 then
                  begin
                  move(x(pr),x33);{only in line 3 and 4
                  movehole(x32);
                  movedown(x22);
                  moveleft(x23);
                  moveup(x33);
                  moveleft(x34);
                  movedown(x24);
                  moveright(x23);
                  moveright(x22);
                  moveup(x32); }
                  end;

      end;
Begin
 Writeln('Enter the first 4 digits(firs row)'); Writeln('For the blank place ENTER 0 ');
 Read(X111 ,X112, X113, X114);
 Writeln('Enter the second 4 digits(second row)'); Writeln('For the blank place ENTER 0 ');
 Read(X21,X22,X23,X24);
 Writeln('Enter the thirth 4 digits(thirth row)'); Writeln('For the blank place ENTER 0 ');
 Read(X31,X32,X33,X34);
 Writeln('Enter the fourth 4 digits(fourth row)'); Writeln('For the blank place ENTER 0 ');
 Read(X41,X42,X43,X44);
 Show;
 if X111=1 then write('first is OK');
end.