#!/usr/bin/perl

sub numerically { return $a <=> $b };

for $xone (0..5) {
for $xtwo (0..5) {
for $xthree (0..5) {
for $xfour (0..5) {

  @l = ($xone,$xtwo,$xthree,$xfour);
  @ll = sort numerically @l;
  ($one,$two,$three,$four) = @ll;
  $sum = $one + $two + $three + $four;
 
  $answer = "X";
  $answer .= "A" if ($sum <= 3);
  $answer .= "B" if ($sum == 7);
  $answer .= "C" if ($sum == 13);
  $answer .= "D" if ($sum >= 17);

  $alle = 1;
  $allo = 1;
  if ($one % 2 == 0) { $allo = 0; } else { $alle = 0; }
  if ($two % 2 == 0) { $allo = 0; } else { $alle = 0; }
  if ($three % 2 == 0) { $allo = 0; } else { $alle = 0; }
  if ($four % 2 == 0) { $allo = 0; } else { $alle = 0; }

  $answer .= "E" if ($one == $two and $three == $four and $two == $three);
  $answer .= "F" if ($one == $two and $three == $four and $two != $three);
  $answer .= "G" if ($one == $two and $three != $four and $two == $three
                and ($allo));
  $answer .= "G" if ($one != $two and $three == $four and $two == $three
                and ($allo));
  $answer .= "H" if ($one == $two and $three != $four and $two == $three
                and ($alle));
  $answer .= "H" if ($one != $two and $three == $four and $two == $three
                and ($alle));
  $answer .= "I" if ($one+1 == $two and $three+1 == $four and $two+1 == $three);

  print "@l $answer\n";
}
}
}
}
