UVA10019




Sample Input

3
265
111
1234
Sample Output

3 5 
6 3 
5 5






EX: N=265(10)
b1=100001001(2)

b2=613(16)=1001100101(2)






import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class UVA10019 {

 public static int ans = 0;

 public static void main(String[] args) throws NumberFormatException,
   IOException {

  BufferedReader in = new BufferedReader(new InputStreamReader(System.in));

  int count = Integer.parseInt(in.readLine());

  for (int i = 0; i < count; i++) {

   int num = Integer.parseInt(in.readLine());

   binary(num);
   ans = 0;
   hexadecimal(num);
   ans = 0;
  }

 }

 private static void binary(int num) {

  String temp = Integer.toBinaryString(num);

  for (int i = 0; i < temp.length(); i++)
   if (temp.charAt(i) == '1')
    ans++;

  System.out.print(ans + " ");

 }

 private static void hexadecimal(int num) {

  String temp = Integer.toString(num);

  int t_num = 0;

  for (int i = 0; i < temp.length(); i++) {

   t_num += num % 10 * Math.pow(16, i);
   num /= 10;

  }

  temp = Integer.toBinaryString(t_num);

  for (int i = 0; i < temp.length(); i++)
   if (temp.charAt(i) == '1')
    ans++;

  System.out.println(ans);

 }

}