{ Uþdavinio autorius: doc. Jonas Blonskis, KTU informatikos fakulteto dëstytojas;
  Testø autorius: doc. Jonas Blonskis;
  Sprendimø autoriai nurodyti þemiau }

program Zv;
uses Crt;
{-------------------------------------------------------}
function Kas1 ( N : integer): string;   { 1996m. Barkauskas }
begin
  if Sqrt( N ) <= Round( Sqrt( N ))
  then Kas1 := 'ÞVAIGÞDUTË'
  else Kas1 := 'TARPAS';

end;
{-------------------------------------------------------}
function Kas2 ( N : integer): string;   { 1988m. Milaknis  }
var x : real;  y : integer;
begin
  x := Sqrt( N );  y := Trunc( x );
  if x = y  then Kas2 := 'ÞVAIGÞDUTË'
            else begin
                     x := Sqr( y ) + y;
                     if  N <= x  then Kas2 := 'TARPAS'
                                 else Kas2 := 'ÞVAIGÞDUTË';
                 end;
end;
{-------------------------------------------------------}
function Kas3 ( N : integer): string;    {1988m. Pranckevièiûtë }
var k, nn : integer;
begin
  k := 1;   nn := N;
  while nn > 0 do
  begin
    nn := nn - k;
    if nn <= 0  then Kas3 := 'ÞVAIGÞDUTË'
                else begin
                     nn := nn - k;
                     if  nn <= 0 then Kas3 := 'TARPAS'
                                 else k := k + 1;
                     end;
  end;
end;
{-------------------------------------------------------}
function Kas4 ( N : integer): string;    {1988m. Zibertas }
var x, b, i : integer;
begin
  x := 0;   b := 1;
  while x < N do
  begin
    for i := 1 to b do x := x+1;
    if x >= N  then Kas4 := 'ÞVAIGÞDUTË'
               else begin
                     for i := 1 to b do x := x+1;
                     if  x >= N then Kas4 := 'TARPAS'
                     end;
    b := b+1;
  end;
end;
{-------------------------------------------------------}
function Kas5 ( N : integer): string;    {1988m. V.Sakalauskas }
var s, i, j : integer;
begin
  s := 0;   i := 0;
  while s < N do  begin   i := i+1;  s := s + i*2;  end;
  if s = N  then Kas5 := 'TARPAS'
            else begin
                       j := s - N;
                       if j >= i then  Kas5 := 'ÞVAIGÞDUTË'
                                 else  Kas5 := 'TARPAS'
                  end;
end;
{-------------------------------------------------------}
function Kas6 ( N : integer): string;    {1988m. Franckevicius }
var bk, j : integer;   jau : boolean;
    {------------------------------}
     procedure Taip;
      var i : integer;
      begin
         jau := False;
         for i := 1 to j do
           begin
                bk := bk + 1;
                if bk = N then jau := True;
           end;
      end;
    {------------------------------}
begin
  bk := 0;   j := 0;
  while bk <= N do
   begin
      j := j+1;
      Taip;    if jau then  Kas6 := 'ÞVAIGÞDUTË';
      Taip;    if jau then  Kas6 := 'TARPAS';
   end;
end;
{-------------------------------------------------------}
var N : integer;
begin
  ClrScr;
  Write( 'Áveskite simboliø sekos numerá: '); ReadLn( N );
  WriteLn( 'Sekoje simbolis Nr ', N:7, ' bus ', Kas1( N ));
  WriteLn( 'Sekoje simbolis Nr ', N:7, ' bus ', Kas2( N ));
  WriteLn( 'Sekoje simbolis Nr ', N:7, ' bus ', Kas3( N ));
  WriteLn( 'Sekoje simbolis Nr ', N:7, ' bus ', Kas4( N ));
  WriteLn( 'Sekoje simbolis Nr ', N:7, ' bus ', Kas5( N ));
  WriteLn( 'Sekoje simbolis Nr ', N:7, ' bus ', Kas6( N ));
  ReadLn;
end.