program daugiakampis;
  { 84 u‘davinys }

  function galima (hor, ver, pkair, pdes : integer) : boolean;
    var lyginiai : boolean; { ar lyginis vis— r–ži— atkarp— skai‡ius }
        kiek : integer; { keli— r–ži— atkarpos duotos }
  begin
    lyginiai := (hor mod 2 = 0) and (ver mod 2 = 0) and
                (pkair mod 2 = 0) and (pdes mod 2 = 0);
    kiek := ord (hor <> 0) + ord (ver <> 0) +
            ord (pkair <> 0) + ord (pdes <> 0);
    galima := lyginiai and (kiek > 1)
  end;

  var f : text;
      hor, ver, pkair, pdes : integer;
begin
  assign (f, 'daug.dat');
  reset (f);
  readln (f, hor);
  readln (f, ver);
  readln (f, pdes);
  readln (f, pkair);
  close (f);

  assign (f, 'daug.rez');
  rewrite (f);
  if galima (hor, ver, pkair, pdes)
     then writeln (f, 'TAIP')
     else writeln (f, 'NE');
  close (f);
end.
