# -*- coding:utf-8 -*- import math if __name__ == "__main__": n = input() for i in xrange(n): a,b = map(int,raw_input().split()) z = int(b * math.log10(a)) temp = round(b*math.log10(a),2) - z s = str(round(pow(a,temp),1)) print s[0],s[1],z