Easy Math > Basic Math

Do you know why base 10 number system is so easy to understand to us? The only reason base-10 math seems "natural" and the other bases don't is that you've been doing base-10 since you were a child. And (nearly) every civilization has used base-10 math probably for the simple reason that we have ten fingers. If instead we lived in a cartoon world, where we would have only four fingers on each hand (count them next time you're watching TV or reading the comics), then the "natural" base system would likely have been base-eight, or "octal". Other than base 10, binary, octal and hexadecimal are popularly known number bases that we use. But number can be in lot more bases than these few. For example, we can consider base 4 or base 22. In this problem you will be given a decimal number and you have to convert that number to a destination base. Input: ------ The first line of the input contains an integer, **T**, representing the number of test cases **(1 ≤ T ≤ 100)**. For each test case, two numbers separated by comma, the first one contains a number **N (0 ≤ N ≤ 2^31-1)**, representing the decimal number and the second one contains a number **B (2 ≤ B ≤ 35)**, representing the destination number system base. Output: ------- For each test case the output should contain a single line with the number in the destination base number system. For base greater than 10, letters A to Z should be used to represent the digit in that base where A means 10, B means 11, C means 12 and so on up to Z. Sample Input ------------ 4 10,2 100,5 999,9 135534,22 Sample Output ------------- 1010 400 1330 CG0E

MD. Jalal Uddin