T = int(input()) for tc in range(1, T+1): A, B = map(int, input().split()) if 1 <= A <= 9 and 1 <= B <= 9: print('#{} {}'.format(tc, A*B)) else: print('#{} -1'.format(tc))