#!/usr/bin/perl -w

# Exercicio 2 da Aula 25 de MAC211.
# M.S.Reis, 11.6.2010

use strict;

my %hash = (menores => [], maiores => []);
my ($i, $j);

$i = $j = 0;

while(<STDIN>){
  chomp $_;
  $_ < 10 and $hash{"menores"}->[$i++] = $_ or $hash{"maiores"}->[$j++] = $_;
}

$i--;
$j--;

print "Menores: ";
print $hash{"menores"}->[$_] . " " foreach 0..$i;
print "\n";

print "Maiores: ";
print $hash{"maiores"}->[$_] . " " foreach 0..$j;
print "\n";

