#!perl -l map/.*(??{$t{"$`($&)$'"}=1})/,@p=@p?keys%t:'',%t=()for 0..shift;print for@p