sub r{map{int rand 10}@_}$"='';$|=@!=r 1..pop;while(@!){@X=r@!;print"@F@X\r";push@F,pop@!if$![0]eq$X[0]}