http://acm.hdu.edu.cn/showproblem.php?pid=1339
/*
2011-9-1
author:BearFly1990
*/
package acm.hdu.tests;
import java.io.BufferedInputStream;
import java.util.Scanner;
public class HDU_1339 {
/**
* @param args
*/
public static void main(String[] args) {
Scanner in = new Scanner(new BufferedInputStream(System.in));
int n;
int t ;
t = in.nextInt();
while( t-- > 0){
while(in.hasNextInt()){
n = in.nextInt();
if( n % 2 == 0){
int p = 0;
while( n % 2 == 0){
n /=2;
p++;
}
System.out.println(n + " " + p);
}else{
System.out.println(n + " " + 0);
}
}
}
}
}