gets;$<.map{|e|a,b=gets.split.map &:to_i;r=Math.log10(a)*b;x=(10**(r+1-z=r.to_i)).to_i;puts'%d %d %d'%[x/10,x%10,z]}