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