# -*- coding:utf-8 -*- if __name__ == "__main__": n = input() for i in xrange(n): a,b = map(int,raw_input().split()) m = a ** b z = 0 while m >= 10: m /= 10.0 z += 1 x = int(m) m -= x y = m / 0.1 print "%d %d %d" % (x,y,z)