while (){ chomp; print grep !$a{$_}++, split m/\s/; print "\n"; }