Given an integer, $n$, print the following values for each integer $\boldsymbol{i}$ from $\mbox{1}$ to $n$:

Decimal
Octal
Hexadecimal (capitalized)
Binary

Function Description   

Complete the print_formatted function in the editor below.   

print_formatted has the following parameters:   

int number: the maximum value to print  

Prints   

The four values must be printed on a single line in the order specified above for each $\boldsymbol{i}$ from $\mbox{1}$ to $number$. Each value should be space-padded to match the width of the binary value of $number$ and the values should be separated by a single space.

Input Format

A single integer denoting $n$.

Constraints

$1\leq n\leq99$

Sample Input
17

Sample Output
    1     1     1     1
    2     2     2    10
    3     3     3    11
    4     4     4   100
    5     5     5   101
    6     6     6   110
    7     7     7   111
    8    10     8  1000
    9    11     9  1001
   10    12     A  1010
   11    13     B  1011
   12    14     C  1100
   13    15     D  1101
   14    16     E  1110
   15    17     F  1111
   16    20    10 10000
   17    21    11 10001

Source: hackerrank | Difficulty: EASY
Tags: String algorithms


Solutions:
N = int(input())
width = len(str(bin(N))) - 2
for n in range(1, N + 1):
	for base in 'doXb':
		print('{0:{width}{base}}'.format(n, base=base, width=width), end=' ')
	print()


N = int(input())
paddingLength = len(bin(N)[2:])
padding = ' ' * paddingLength
for i in range(1, N + 1):
	print(('{0:>' + str(paddingLength) + 'd} {0:>' + str(paddingLength) + 'o} {0:>' + str(paddingLength) + 'X} {0:>' + str(paddingLength) + 'b}').format(i))


n = int(input())
lb = len(bin(n)) - 1
for i in range(1, n + 1):
	print('{{0: >{}}}'.format(lb - 1).format(i) + '{{0: >{}}}'.format(lb).format(oct(i)[2:]) + '{{0: >{}}}'.format(lb).format(hex(i)[2:].upper()) + '{{0: >{}}}'.format(lb).format(bin(i)[2:]))


import sys
import math
file = sys.stdin
N = int(file.readline())
width = math.floor(math.log2(N)) + 1
for i in range(N):
	print('{num: {width}d} {num:{width}o} {num:{width}X} {num:{width}b}'.format(num=i + 1, width=width))


n = int(input())
m = len(bin(n)) - 2
for i in range(n):
	print('{0:d}'.format(i + 1).rjust(m), end=' ')
	print('{0:o}'.format(i + 1).rjust(m), end=' ')
	print('{0:X}'.format(i + 1).rjust(m), end=' ')
	print('{0:b}'.format(i + 1).rjust(m), end=' ')
	print()


import sys
n = int(sys.stdin.readline())
l = len('{:b}'.format(n))
fmt = '{0:{1}d} {0:{1}o} {0:{1}X} {0:{1}b}\n'
for i in range(1, n + 1):
	sys.stdout.write(fmt.format(i, l))


n = int(input())
l = len(bin(n)) - 2
for i in range(1, n + 1):
	print(' '.join(map(lambda x: ' ' * (l - len(x)) + x, [str(i), oct(i)[2:], hex(i)[2:].upper(), bin(i)[2:]])))


n = int(input())
l = str(len(bin(n)) - 2)
for i in range(1, n + 1):
	print(('%' + l + 'd %' + l + 'd %' + l + 's %' + l + 'd') % (i, int(str(oct(i))[2:]), str(hex(i))[2:].upper(), int(str(bin(i))[2:])))


K = int(input())
max_len = len(bin(K)) - 2
field = lambda x: '{{: >{}}}'.format(max_len).format(x)
for i in range(1, K + 1):
	print(' '.join(map(field, [i, oct(i)[2:], hex(i)[2:].upper(), bin(i)[2:]])))


N = int(input())
length = len(bin(N)) - 1
for i in range(1, N + 1):
	print(' ' * (length - len(str(i)) - 1) + str(i) + ' ' * (length + 2 - len(oct(i))) + oct(i)[2:] + ' ' * (length + 2 - len(hex(i))) + hex(i).upper()[2:] + ' ' * (length + 2 - len(bin(i))) + bin(i)[2:])


n = int(input())
width = len('{:b}'.format(n))
fmt = '{0:>%d} {0:>%do} {0:>%dX} {0:>%db}' % (width, width, width, width)
for i in range(n):
	j = i + 1
	print(fmt.format(j))


N = int(input())
l = len(bin(N)) - 2
for i in range(1, N + 1):
	f = ''
	for c in 'doXb':
		if f:
			f += ' '
		f += '{:>' + str(l) + c + '}'
	print(f.format(i, i, i, i))


n = int(input())
lb = len(str(bin(n)[2:]))
for i in range(1, n + 1):
	l = len(bin(i))
	print(str(i).rjust(lb) + ' ' + str(oct(i)[2:]).rjust(lb).upper() + ' ' + str(hex(i)[2:]).rjust(lb).upper() + ' ' + str(bin(i)[2:]).rjust(lb))


dec = int(input())
l = len(str(bin(dec)[2:])) + 1
for i in range(1, dec + 1):
	a = str(i)
	b = str(oct(i)[2:])
	c = str(hex(i)[2:]).upper()
	d = str(bin(i)[2:])
	print('{0}{1}{2}{3}'.format(a.rjust(l - 1), b.rjust(l), c.rjust(l), d.rjust(l)))


n = int(input())
lx = 1
pw = 1
while 2 * pw <= n:
	pw = pw * 2
	lx += 1
for x in range(1, n + 1):
	print('{0:{1}d} {0:{1}o} {0:{1}X} {0:{1}b}'.format(x, lx))


n = int(input())
format_length = len(bin(n)) - 2
for i in range(1, n + 1):
	for b in 'doXb':
		print('{0:{w}{b}}'.format(i, b=b, w=format_length), end=' ')
	print()


n = int(input().strip())
width = len('{0:b}'.format(n))
for i in range(1, n + 1):
	print(('{0:>' + str(width) + 'd} {0:>' + str(width) + 'o} {0:>' + str(width) + 'X} {0:>' + str(width) + 'b}').format(i))


a = int(input())
for b in range(1, a + 1):
	e = len(format(a, 'b'))
	if b < 100:
		hx = format(b, 'x').rjust(e)
		hx = hx.upper()
		print(str(b).rjust(e) + ' ' + str(format(b, 'o')).rjust(e) + ' ' + hx + ' ' + str(format(b, 'b')).rjust(e))


def convert(n, base):
	lookup = '0123456789ABCDEF'
	if n < base:
		return lookup[n]
	else:
		return convert(n // base, base) + lookup[n % base]

def fun():
	num = int(input())
	decimal = list(range(1, num + 1))
	octal = list(range(1, 8))
	hexadecimal = list(range(1, 10))
	octal1 = [convert(x, 8) for x in range(8, num + 1)]
	hexadecimal1 = [convert(x, 16) for x in range(10, num + 1)]
	binary = [convert(x, 2) for x in range(1, num + 1)]
	octal.extend(octal1)
	hexadecimal.extend(hexadecimal1)
	l = len(str(binary[num - 1]))
	for i in range(num):
		print(str(decimal[i]).rjust(l), str(octal[i]).rjust(l), str(hexadecimal[i]).rjust(l), str(binary[i]).rjust(l))
fun()


t = int(input())
n = 1
bi = bin(t)
oc = oct(t)
he = hex(t)
bil = list(map(int, bi.split('b')))
ocl = list(map(int, oc.split('o')))
hel = list(he.split('x'))
if hel[1].islower():
	hel[1] = hel[1].upper()
ld = len(str(t))
lh = len(str(hel[1]))
lb = len(str(bil[1]))
lo = len(str(ocl[1]))
while n <= t:
	bi = bin(n)
	oc = oct(n)
	he = hex(n)
	bil = list(map(int, bi.split('b')))
	ocl = list(map(int, oc.split('o')))
	hel = list(he.split('x'))
	if hel[1].islower():
		hel[1] = hel[1].upper()
	lds = len(str(n))
	lhs = len(str(hel[1]))
	lbs = len(str(bil[1]))
	los = len(str(ocl[1]))
	ansd = ''
	ansb = ''
	ansh = ''
	anso = ''
	i = 0
	while i < lb - lds:
		ansd = ansd + ' '
		i += 1
	ansd = ansd + str(n)
	i = 0
	while i < lb - lbs:
		ansb = ansb + ' '
		i += 1
	ansb = ansb + str(bil[1])
	i = 0
	while i < lb - lhs:
		ansh = ansh + ' '
		i += 1
	ansh = ansh + str(hel[1])
	i = 0
	while i < lb - los:
		anso = anso + ' '
		i += 1
	anso = anso + str(ocl[1])
	print(ansd + ' ' + anso + ' ' + ansh + ' ' + ansb)
	n += 1


n = int(input())
for i in range(1, n + 1):
	print('{0:{w}d} {0:{w}o} {0:{w}X} {0:{w}b}'.format(i, w=len(bin(n)) - 2))


import sys
n = int(sys.stdin.readline())
l = len('{:b}'.format(n))
f = '{{x:>{l}}} {{x:>{l}o}} {{x:>{l}X}} {{x:>{l}b}}'.format(l=l)
for x in range(1, n + 1):
	print(f.format(x=x))


N = int(input())
binary = str(bin(N))[2:]
length = len(binary)
for num in range(1, N + 1):
	data = [oct(num), hex(num), bin(num)]
	data = [str(num).rjust(length)] + [str(x)[2:].upper().rjust(length) for x in data]
	print(' '.join(data))


def convertToBin(n):
	if n == 0:
		return ''
	else:
		return convertToBin(n // 2) + str(n % 2)

def convertToHex(n):
	if n == 0:
		return ''
	elif n == 10:
		return 'A'
	elif n == 11:
		return 'B'
	elif n == 12:
		return 'C'
	elif n == 13:
		return 'D'
	elif n == 14:
		return 'E'
	elif n == 15:
		return 'F'
	else:
		return convertToHex(n // 16) + str(validateHex(n % 16))

def validateHex(n):
	if n == 0:
		return n
	elif n == 10:
		return 'A'
	elif n == 11:
		return 'B'
	elif n == 12:
		return 'C'
	elif n == 13:
		return 'D'
	elif n == 14:
		return 'E'
	elif n == 15:
		return 'F'
	else:
		return n

def convertToDec(n):
	if n == 0:
		return ''
	else:
		return convertToDec(n // 10) + str(n % 10)

def convertToOct(n):
	if n == 0:
		return ''
	else:
		return convertToOct(n // 8) + str(n % 8)
num = int(input())
a = len(convertToBin(num))
for i in range(1, num + 1):
	print('%2s %2s %2s %2s' % (convertToDec(i).rjust(a), convertToOct(i).rjust(a), convertToHex(i).rjust(a), convertToBin(i).rjust(a)))


import sys
N = int(sys.stdin.readline().strip())
width = len(bin(N)[2:])
for i in range(1, N + 1):
	for base in 'doXb':
		print('{0:{width}{base}}'.format(i, base=base, width=width), end=' ')
	print()


def main():
	n = int(input())
	pad = len(bin(n)) - 2
	for i in range(1, n + 1):
		h = '%X' % i
		print(str(i).rjust(pad), oct(i)[2:].rjust(pad), h.rjust(pad), bin(i)[2:].rjust(pad))
main()


(n,) = map(int, input().split())
k = len(bin(n)) - 1
print('\n'.join(['%*d%*s%*s%*s' % (k - 1, i, k, oct(i)[2:], k, hex(i)[2:].upper(), k, bin(i)[2:]) for i in range(1, n + 1)]))


N = int(input())
width = len(bin(N)[2:]) + 1
for i in range(1, N + 1):
	for base in 'doXb':
		t = width
		if base == 'd':
			t -= 1
		print('{0:>{width}{base}}'.format(i, base=base, width=t), end='')
	print()


N = int(input())
a = len(str(bin(N))[2:]) + 1
for i in range(1, N + 1):
	b = str(i).rjust(a - 1) + str(oct(i))[2:].rjust(a) + str(hex(i).upper())[2:].rjust(a) + str(bin(i))[2:].rjust(a)
	print(b)


N = int(input())
for i in range(1, N + 1):
	l = len(bin(N)[2:])
	print(str(i).rjust(l), oct(i)[2:].rjust(l), hex(i)[2:].rjust(l).upper(), bin(i)[2:].rjust(l))


n = int(input())
max1 = 0
max2 = 0
max3 = 0
max4 = 0
for i in range(n):
	if max1 < len(str(i + 1)):
		max1 = len(str(i + 1))
	if max1 < len(oct(i + 1)[2:]):
		max1 = len(oct(i + 1)[2:])
	if max1 < len(hex(i + 1)[2:]):
		max1 = len(hex(i + 1)[2:])
	if max1 < len(bin(i + 1)[2:]):
		max1 = len(bin(i + 1)[2:])
for i in range(n):
	print(' ' * (max1 - len(str(i + 1))) + str(i + 1), ' ' * (max1 - len(oct(i + 1)[2:])) + oct(i + 1)[2:], ' ' * (max1 - len(hex(i + 1).upper()[2:])) + hex(i + 1).upper()[2:], ' ' * (max1 - len(bin(i + 1)[2:])) + bin(i + 1)[2:])


n = int(input())
bin_n = len(bin(n)[2:])
st = '{0:' + str(bin_n) + 'd} {1:' + str(bin_n) + 'o} {2:' + str(bin_n) + 'X} {3:' + str(bin_n) + 'b}'
for i in range(1, n + 1):
	print(st.format(i, i, i, i))


import sys
stdin = sys.stdin
n = int(stdin.readline())
m = n
w = 0
while m > 0:
	m //= 2
	w += 1
fom = '{0:' + str(w) + 'd} ' + '{0:' + str(w) + 'o} ' + '{0:' + str(w) + 'X} ' + '{0:' + str(w) + 'b} '
for i in range(1, n + 1):
	print(fom.format(i))


def print_nums(ub):
	n = len(bin(ub)) - 2
	for i in range(1, ub + 1):
		print('{1:{0}d} {1:{0}o} {1:{0}X} {1:{0}b}'.format(n, i))
ub = int(input())
print_nums(ub)


import sys
N = int(sys.stdin.readline().strip())
n_len = str(len(bin(N)[2:]))
for n in range(1, N + 1):
	binary = bin(n)[2:]
	binary = ' ' * (int(n_len) - len(binary)) + binary
	fmts = list(('%' + n_len + x for x in ('d', 'o', 'X')))
	print(' '.join([x % n for x in fmts] + [binary]))


__author__ = 'bkroczek'
no = int(input())
s = len(bin(no)) - 2
for n in range(1, no + 1):
	print('{1:>{0}} {2:>{0}} {3:>{0}} {4:>{0}}'.format(s, n, oct(n).split('o')[1], hex(n).split('x')[1].upper(), bin(n).split('b')[1]))


dec = int(input())
width = len(str(bin(dec))) - 2
for i in range(1, dec + 1):
	print('{:>{width}}'.format(i, width=width) + '{:>{width}}'.format(str(oct(i))[2:], width=width + 1) + '{:>{width}}'.format(str(hex(i))[2:].upper(), width=width + 1) + '{:>{width}}'.format(str(bin(i))[2:], width=width + 1))


import math
n = int(input())
sp = math.ceil(math.log(n, 2))
if n & n - 1 == 0:
	sp += 1
for x in range(1, n + 1):
	hn = format(x, 'x')
	nn = hn.upper()
	print('{} {} {} {}'.format(str(x).rjust(sp), format(x, 'o').rjust(sp), nn.rjust(sp), format(x, 'b').rjust(sp)))


N = int(input())
for n in range(1, N + 1):
	l = len(bin(N)) - 2
	formatStr = ('%' + str(l) + 's ') * 4
	print(formatStr % (str(n), oct(n)[2:], hex(n)[2:].upper(), bin(n)[2:]))


N = int(input())
max_len = len(bin(N)[2:])
for i in range(1, N + 1):
	print('%s %s %s %s' % (str(i).rjust(max_len), oct(i)[2:].rjust(max_len), hex(i).upper()[2:].rjust(max_len), bin(i)[2:].rjust(max_len)))


n = int(input().strip())
w = len(str(bin(n))[2:])
for i in range(1, n + 1, 1):
	o = str(oct(i))[2:]
	h = str(hex(i))[2:]
	h = h.upper()
	b = str(bin(i))[2:]
	d = str(i)
	print('{:>{width}} {:>{width}} {:>{width}} {:>{width}}'.format(d, o, h, b, width=w))


t = int(input())
output = []
max_len = len(bin(t)[2:])
te = t - 1
while t > 0:
	b = bin(t)[2:]
	o = oct(t)[2:]
	h = hex(t)[2:]
	h = h.upper()
	l1 = max_len - len(str(t))
	l2 = max_len - len(o)
	l3 = max_len - len(h)
	l4 = max_len - len(b)
	outstr = ''
	for i in range(l1):
		outstr += ' '
	outstr += str(t) + ' '
	for i in range(l2):
		outstr += ' '
	outstr += o + ' '
	for i in range(l3):
		outstr += ' '
	outstr += h + ' '
	for i in range(l4):
		outstr += ' '
	outstr += b + ' '
	output.append(outstr)
	t -= 1
while te >= 0:
	print(output[te])
	te -= 1


N = int(input())
width = len(format(N, 'b'))
for num in range(1, N + 1):
	for base in 'doXb':
		print('{0:{width}{base}}'.format(num, base=base, width=width), end=' ')
	print()


__author__ = 'Chamath'

def finder():
	N = int(input())
	width = len(bin(N)[2:])
	for num in range(1, N + 1):
		for base in 'doXb':
			print('{0:{width}{base}}'.format(num, base=base, width=width), end=' ')
		print()
finder()


def main():
	N = int(input())
	dN = str(bin(N))[2:]
	length = len(dN)
	form = '%' + str(length) + 's '
	form = form + form + form + form
	for i in range(1, N + 1):
		d10 = str(i)
		d8 = str(oct(i))[2:]
		d16 = str(hex(i))[2:].upper()
		d2 = str(bin(i))[2:]
		print(form % (d10, d8, d16, d2))
main()


n = int(input())
binLen = len(bin(n)) - 2

def lineof(i):
	formStr = '{0}0:{2}d{1} {0}0:{2}o{1} {0}0:{2}X{1} {0}0:{2}b{1}'.format('{', '}', binLen)
	return formStr.format(i)
for i in range(1, n + 1):
	print(lineof(i))


digs = '0123456789ABCDEFG'

def intstr(n, base):
	digits = []
	while n != 0:
		digits.append(digs[n % base])
		n //= base
	digits.reverse()
	return ''.join(digits)
N = int(input())
width = len(intstr(N, 2))
format_string = '{:>' + str(width) + '}'
for i in range(1, N + 1):
	for base in [10, 8, 16, 2]:
		print(format_string.format(intstr(i, base)), end=' ')
	print()


N = int(input())
largestBinary = ''
curVal = N
while curVal > 0:
	largestBinary = str(curVal % 2) + largestBinary
	curVal = int(curVal / 2)
for i in range(1, N + 1):
	curVal = i
	binaryForm = ''
	while curVal > 0:
		binaryForm = str(curVal % 2) + binaryForm
		curVal = int(curVal / 2)
	curVal = i
	octalForm = ''
	while curVal > 0:
		octalForm = str(curVal % 8) + octalForm
		curVal = int(curVal / 8)
	curVal = i
	hexForm = ''
	while curVal > 0:
		newItem = curVal % 16
		if newItem == 10:
			newItem = 'A'
		elif newItem == 11:
			newItem = 'B'
		elif newItem == 12:
			newItem = 'C'
		elif newItem == 13:
			newItem = 'D'
		elif newItem == 14:
			newItem = 'E'
		elif newItem == 15:
			newItem = 'F'
		hexForm = str(newItem) + hexForm
		curVal = int(curVal / 16)
	d = len(largestBinary)
	print(str(i).rjust(d) + ' ' + octalForm.rjust(d) + ' ' + hexForm.rjust(d) + ' ' + binaryForm.rjust(d))


def bin_(n):
	return bin(n)[2:]

def oct_(n):
	return oct(n)[2:]

def hex_(n):
	return hex(n)[2:].upper()
n = int(input())
maxlen = len(bin_(n))
formatter = '{{:>{0}}} {{:>{0}}} {{:>{0}}} {{:>{0}}}'.format(maxlen)
for i in range(1, n + 1):
	print(formatter.format(i, oct_(i), hex_(i), bin_(i)))


N = int(input())
w = len(bin(N)[2:])
for i in range(1, N + 1):
	b = bin(i)[2:].upper()
	o = oct(i)[2:].upper()
	h = hex(i)[2:].upper()
	print(str(i).rjust(w), o.rjust(w), h.rjust(w), b.rjust(w))


x = int(input())
lenr = len(bin(x)[2:])
for i in range(1, x + 1):
	hex = '%X' % i
	print(str(i).rjust(lenr), oct(i)[2:].rjust(lenr), hex.rjust(lenr), bin(i)[2:].rjust(lenr))


N = int(input())
digits = len(bin(N)) - 2
for i in range(1, N + 1):
	print('{0:>{1}} {0:>{1}o} {0:>{1}X} {0:>{1}b}'.format(i, digits))


T = int(input())
s = len('{0:b}'.format(T))
for i in range(T):
	e = '{0:%id} {0:%io} {0:%iX} {0:%ib}' % (s, s, s, s)
	print(e.format(i + 1))


N = int(input())
NBin = bin(N)[2:]
binLen = len(NBin)
for i in range(0, N):
	num = i + 1
	bNum = bin(num)[2:]
	print('{a:>{b}{c}d} {a:>{b}{c}o} {a:>{b}{c}X} {d:>{c}s}'.format(a=num, b=' ', c=binLen, d=bNum))


N = int(input())
pad = len(bin(N)[2:]) + 1
for i in range(1, N + 1):
	s = (str(i).rjust(pad - 1) + oct(i)[2:].rjust(pad) + hex(i)[2:].rjust(pad) + bin(i)[2:].rjust(pad)).upper()
	print(s)


import sys
N = int(sys.stdin.read().strip())
output = [(str(i), oct(i)[2:], hex(i)[2:].upper(), bin(i)[2:]) for i in range(1, N + 1)]
paddingSize = len(output[-1][-1])
format_string = '{num: >{fill}}'
for line in output:
	formated_line = (format_string.format(num=i, fill=paddingSize) for i in line)
	sys.stdout.write(' '.join(formated_line))
	sys.stdout.write('\n')


N = int(input())
W = len(bin(N)) - 2
for n in range(1, N + 1):
	print(' '.join([s.rjust(W) for s in [str(n), oct(n)[2:], hex(n)[2:].upper(), bin(n)[2:]]]))


import math
n = int(input())
width = int(math.floor(math.log(n, 2)) + 1)
formatstr = '{{i:>{w}d}} {{i:>{w}o}} {{i:>{w}X}} {{i:>{w}b}}'.format(w=width)
for i in range(1, n + 1):
	print(formatstr.format(i=i))


N = -1
while N not in range(100):
	N = int(input())
p = len(list(str(bin(N)))) - 1
for i in range(1, N + 1):
	a = len(list(str(i)))
	c = len(list(str(hex(i)))) - 2
	e = len(list(str(oct(i)))) - 2
	d = len(list(str(bin(i)))) - 2
	q = ' ' * (p - 1 - a)
	f = q + str(i) + ' ' * (p - e) + str(oct(i))[2:] + ' ' * (p - c) + str(hex(i))[2:].upper() + ' ' * (p - d) + str(bin(i))[2:]
	print(f)


n = int(input())
l = len(format(n, 'b'))
for i in range(1, n + 1):
	print(' '.join((x.rjust(l) for x in [str(i), format(i, 'o'), format(i, 'x').upper(), format(i, 'b')])))


import sys
x = sys.stdin.readline().split(' ')[0]
bin_len = len(bin(int(x))[2:])
for i in range(1, int(x) + 1):
	sys.stdout.write('%s ' % str(i).rjust(bin_len, ' '))
	sys.stdout.write('%s ' % oct(i)[2:].rjust(bin_len, ' '))
	sys.stdout.write('%s ' % hex(i)[2:].upper().rjust(bin_len, ' '))
	sys.stdout.write('%s ' % bin(i)[2:].rjust(bin_len, ' '))
	sys.stdout.write('\n')


import sys
numbers = int(sys.stdin.readline().rstrip())
width = len('{0:b}'.format(numbers)) + 1
number_list = list()
for num in range(1, numbers + 1):
	print('{0: >{w1}}{0: >{w}o}{0: >{w}X}{0: >{w}b}'.format(num, w1=width - 1, w=width))


n = eval(input())
lines = []
maxlen = 0
for i in range(1, n + 1):
	temp = []
	temp.append(str(i))
	temp.append(oct(i)[2:])
	temp.append(hex(i)[2:].upper())
	temp.append(bin(i)[2:])
	if len(bin(i)[2:]) > maxlen:
		maxlen = len(bin(i)[2:])
	lines.append(temp)
for line in lines:
	for word in line:
		print('{0:s}'.format(word).rjust(maxlen), end=' ')
	print('')


n = int(input())
temp = n
lent = 0
while temp > 0:
	lent = lent + 1
	temp //= 2
for i in range(1, n + 1):
	word = list(' ' * lent)
	temp = i
	k = lent - 1
	while temp > 0:
		word[k] = str(temp % 10)
		temp //= 10
		k -= 1
	print('%s' % ''.join(word), end='')
	word = list(' ' * lent)
	temp = i
	k = lent - 1
	while temp > 0:
		word[k] = str(temp % 8)
		temp //= 8
		k -= 1
	print('%s' % (' ' + ''.join(word)), end='')
	word = list(' ' * lent)
	temp = i
	k = lent - 1
	while temp > 0:
		a = temp % 16
		if a == 10:
			b = 'A'
		elif a == 11:
			b = 'B'
		elif a == 12:
			b = 'C'
		elif a == 13:
			b = 'D'
		elif a == 14:
			b = 'E'
		elif a == 15:
			b = 'F'
		else:
			b = str(a)
		word[k] = b
		temp //= 16
		k -= 1
	print('%s' % (' ' + ''.join(word)), end='')
	word = list(' ' * lent)
	temp = i
	k = lent - 1
	while temp > 0:
		word[k] = str(temp % 2)
		temp //= 2
		k -= 1
	print('%s' % (' ' + ''.join(word)))


def prepend(s, l):
	d = l - len(s)
	return d * ' ' + s
N = int(input())
maxlen = len(bin(N)) - 2
for i in range(1, N + 1):
	binary = prepend(bin(i)[2:], maxlen)
	decimal = prepend(str(i), maxlen)
	octal = prepend(oct(i)[2:], maxlen)
	hexdec = prepend(hex(i)[2:].upper(), maxlen)
	print(decimal + ' ' + octal + ' ' + hexdec + ' ' + binary)


import math
n = int(input())
max_length = math.floor(math.log(n, 2)) + 1
for i in range(1, n + 1):
	d = str(i).rjust(max_length)
	o = str(oct(i))[2:].rjust(max_length)
	h = str(hex(i))[2:].upper().rjust(max_length)
	b = bin(i)[2:].lstrip('0').rjust(max_length)
	print('{} {} {} {}'.format(d, o, h, b))


N = int(input())
l = list()
w = len(str(bin(N))[2:]) + 1
for i in range(1, N + 1):
	o = str(oct(i))[2:]
	h = '%X' % i
	b = str(bin(i))[2:]
	print('%s%s%s%s' % (str(i).rjust(w - 1), o.rjust(w), h.rjust(w), b.rjust(w)))


def sformat(n, max_b):
	width = len('{0:b}'.format(max_b))
	print('{0:>{arg}} {0:>{arg}o} {0:>{arg}X} {0:>{arg}b} '.format(n, arg=width))
N = int(input())
for i in range(1, N + 1):
	sformat(i, N)


n = int(input())
w = len('{:b}'.format(n))
for i in range(1, n + 1):
	de = str(i)
	oc = '{:o}'.format(i)
	he = '{:X}'.format(i)
	bi = '{:b}'.format(i)
	print(' '.join((str(s).rjust(w) for s in [de, oc, he, bi])))


import sys
N = int(sys.stdin.readline())
lines = [[str(i), oct(i)[2:], hex(i)[2:].upper(), bin(i)[2:]] for i in range(1, N + 1)]
widths = list(map(len, lines[-1]))
M = len(widths)
for i in range(N):
	for j in range(M):
		w = widths[-1]
		s = lines[i][j]
		if j > 0:
			sys.stdout.write(' ')
		sys.stdout.write(' ' * (w - len(s)) + s)
	sys.stdout.write('\n')


def printData(n):
	l = len(bin(n)[2:])
	for i in range(1, n + 1):
		print('%*s %*s %*s %*s' % (l, i, l, oct(i)[2:], l, hex(i)[2:].upper(), l, bin(i)[2:]))

def main():
	n = int(input())
	printData(n)
main()


count = int(input())
width = len(bin(count)[2:])
template = '{:>' + str(width) + '} '
template = template * 4
for i in range(1, count + 1):
	print(template.format(i, oct(i)[2:], hex(i)[2:].upper(), bin(i)[2:]))


import sys
n = int(sys.stdin.readline())
width = len(bin(n)[2:])
for x in range(1, n + 1):
	values = [str(x), oct(x)[2:], hex(x)[2:].upper(), bin(x)[2:]]
	print(' '.join((v.rjust(width, ' ') for v in values)))


import math
N = int(input())
width = 1 + math.floor(math.log(N, 2))
for i in range(1, N + 1):
	print('{0:d}'.format(i).rjust(width), '{0:o}'.format(i).rjust(width), '{0:X}'.format(i).rjust(width), '{0:b}'.format(i).rjust(width))


N = int(input())
width = str(len('{:b}'.format(N)))
form = width.join(('{:>', 'd} {:>', 'o} {:>', 'X} {:>', 'b}'))
for i in range(1, N + 1):
	print(form.format(i, i, i, i))


N = int(input())
width = len(bin(N)[2:])
fstr = '{{0:>{0}}} {{1:>{0}}} {{2:>{0}}} {{3:>{0}}}'.format(width)
for i in range(1, N + 1):
	print(fstr.format(i, oct(i)[2:], hex(i)[2:].upper(), bin(i)[2:]))


n = int(input())
width = len(bin(n)) - 2
for x in range(1, n + 1):
	for base in 'doXb':
		print('{0:{width}{base}}'.format(x, base=base, width=width), end=' ')
	print()


def bina(n):
	rep = bin(n)[2:]
	pad = m - len(rep)
	return pad * ' ' + rep

def inta(n):
	rep = str(n)
	pad = m - len(rep)
	return pad * ' ' + rep + ' '

def octa(n):
	rep = oct(n)[2:]
	pad = m - len(rep)
	return pad * ' ' + rep + ' '

def hexa(n):
	rep = hex(n)[2:].upper()
	pad = m - len(rep)
	return pad * ' ' + rep + ' '
k = int(input())
m = len(bin(k).lstrip('0b'))
for i in range(1, k + 1):
	r = [inta(i), octa(i), hexa(i), bina(i)]
	print(''.join(r))


n = int(input())
max = [0, 0, 0, 0]
for i in range(30):
	max[0] = len(str(i)) if len(str(i)) > max[0] else max[0]
	max[1] = len(oct(i)[2:]) if len(oct(i)[2:]) > max[1] else max[1]
	max[2] = len(hex(i)[2:]) if len(hex(i)[2:]) > max[2] else max[2]
	max[3] = len(bin(i)[2:]) if len(bin(i)[2:]) > max[3] else max[3]
max = len(bin(n)[2:])
for i in range(1, n + 1):
	print('{} {} {} {}'.format(str(i).rjust(max), oct(i)[2:].rjust(max), hex(i)[2:].rjust(max).upper(), str(bin(i))[2:].rjust(max)))


N = int(input())
largest_binary_width = len('{:b}'.format(N))
padding = largest_binary_width
bases = ['d', 'o', 'X', 'b']
format_templates = ['{{:{0}{1}}}'.format(padding, base) for base in bases]
for x in range(1, N + 1):
	print(' '.join((template.format(x) for template in format_templates)))


N = int(input())
length = str(len(bin(N)[2:]))
format_string = '{0:>' + length + 'd} {0:>' + length + 'o} {0:>' + length + 'X} {0:>' + length + 'b}'
for i in range(1, N + 1):
	print(format_string.format(i))


n = int(input())
space = len(bin(n)) - 2
for i in range(1, n + 1):
	string = ''
	for j in range(0, space - len(list(str(i)))):
		string += ' '
	string += str(i)
	string += ' '
	for j in range(0, space - len(oct(i)) + 2):
		string += ' '
	string += str(oct(i))[2:]
	string += ' '
	for j in range(0, space - len(hex(i)) + 2):
		string += ' '
	string += str(hex(i))[2:].upper()
	string += ' '
	for j in range(0, space - len(bin(i)) + 2):
		string += ' '
	string += str(bin(i))[2:]
	print(string)


n = int(input())
width = len(bin(n)[2:])
for i in range(n):
	for base in 'doXb':
		print('{0:{width}{base}}'.format(i + 1, base=base, width=width), end=' ')
	print()


n = int(input())
siz = len(bin(n)) - 2
for i in range(1, n + 1):
	s1 = siz - len(str(i))
	s2 = siz - len(oct(i)) + 2
	s3 = siz - len(hex(i)) + 2
	s4 = siz - len(bin(i)) + 2
	print(' ' * s1, end='')
	print(str(i), end=' ')
	print(' ' * s2, end='')
	print(oct(i)[2:], end=' ')
	print(' ' * s3, end='')
	print(hex(i)[2:].upper(), end=' ')
	print(' ' * s4, end='')
	print(bin(i)[2:])


N = int(input())
width = 1
if N >= 64:
	width = 7
elif N >= 32:
	width = 6
elif N >= 16:
	width = 5
elif N >= 8:
	width = 4
elif N >= 4:
	width = 3
elif N >= 2:
	width = 2
else:
	width = 1
for i in range(1, N + 1):
	print('{0:{width}d} {0:{width}o} {0:{width}X} {0:{width}b}'.format(i, width=width))


n = int(input())
g = []
for x in range(n):
	g.append([])
	for y in range(4):
		g[x].append(x + 1)
		g[x].append(oct(x + 1)[2:])
		g[x].append(hex(x + 1)[2:])
		g[x].append(bin(x + 1)[2:])
space = len(bin(n)[2:]) + 1
for x in range(n):
	for y in range(4):
		if y == 0:
			if g[x][y] < 10:
				for i in range(space - 2):
					print(' ', end='')
			else:
				for i in range(space - 3):
					print(' ', end='')
			print(g[x][y], end='')
		if y != 0:
			leng = len(g[x][y])
			for i in range(space - leng):
				print(' ', end='')
			if y == 2:
				g[x][y] = g[x][y].upper()
			print(g[x][y], end='')
	print()


import sys
n = int(sys.stdin.readline())
width = len(bin(n)) - 2
for i in range(n):
	decnum = str(i + 1).rjust(width)
	octnum = oct(i + 1)[2:].rjust(width)
	hexnum = hex(i + 1)[2:].upper().rjust(width)
	binnum = bin(i + 1)[2:].rjust(width)
	print('{0} {1} {2} {3}'.format(decnum, octnum, hexnum, binnum))


N = int(input())
mbi = len(format(N, 'b')) + 1
for i in range(1, N + 1):
	de = str(i).rjust(mbi - 1, ' ')
	oc = format(i, 'o').rjust(mbi, ' ')
	he = format(i, 'X').rjust(mbi, ' ')
	bi = format(i, 'b').rjust(mbi, ' ')
	print(de + oc + he + bi)


n = int(input())
binlength = len(bin(n)) - 2
for i in range(1, n + 1):
	print(str(i).rjust(binlength), str(oct(i))[2:].rjust(binlength), str(hex(i))[2:].rjust(binlength).upper(), str(bin(i))[2:].rjust(binlength))


n = int(input())
w = len('{0:b}'.format(n))
for x in range(1, n + 1):
	print('%*s %*s %*s %*s' % (w, x, w, format(x, 'o'), w, format(x, 'X'), w, format(x, 'b')))


import sys
from operator import itemgetter
from math import log, ceil
firstline = input().split()
N = int(firstline[0])
for n in range(1, N + 1):
	decval = str(n)
	octval = str(oct(n))[2:]
	hexval = str(hex(n))[2:].upper()
	binval = str(bin(n))[2:]
	formatstring = '%{0}s %{0}s %{0}s %{0}s'.format(ceil(log(N + 1, 2)))
	print(formatstring % (decval, octval, hexval, binval))


num = int(input())
a = len(bin(num)[2:])
for i in range(1, num + 1):
	print(str(i).rjust(a), str(oct(i)[2:]).rjust(a), str('0x%X' % i)[2:].rjust(a), str(bin(i)[2:]).rjust(a))


strnum = input()
num = int(strnum)
pad = len(str('{0:b}'.format(num)))
for i in range(1, num + 1):
	strNum = str(i)
	octstr = str(oct(i))
	finaloct = octstr[2:]
	hexstr = str(hex(i))
	finalhex = hexstr[2:].upper()
	bNum = '{0:b}'.format(i)
	strbNum = str(bNum)
	print(strNum.rjust(pad), end=' ')
	print(finaloct.rjust(pad), end=' ')
	print(finalhex.rjust(pad), end=' ')
	print(strbNum.rjust(pad), end='\n')


N = int(input())
bl = max((len('{:b}'.format(i)) for i in range(1, N + 1)))
for i in range(1, N + 1):
	b = '{:b}'.format(i)
	h = '{:x}'.format(i).upper()
	o = '{:o}'.format(i)
	d = '{:d}'.format(i)
	print(d.rjust(bl), o.rjust(bl), h.rjust(bl), b.rjust(bl))


val = int(input())
ans = [(str(x), str(oct(x))[2:], str(hex(x)).upper()[2:], str(bin(x)[2:])) for x in range(1, val + 1)]
padding = 0
for x in ans:
	for i in range(4):
		padding = max(padding, len(x[i]))
for row in ans:
	print(' '.join([row[i].rjust(padding) for i in range(4)]))


n = int(input())
l = len(bin(n)[2:])
for i in range(1, n + 1):
	print(repr(i).rjust(l), oct(i)[2:].rjust(l), hex(i)[2:].rjust(l).upper(), bin(i)[2:].rjust(l))


def base10toN(num, b, numerals='0123456789abcdefghijklmnopqrstuvwxyz'):
	return num == 0 and numerals[0] or base10toN(num // b, b, numerals).lstrip(numerals[0]) + numerals[num % b]
N = int(input())
w = len(base10toN(N, 2))
for i in range(1, N + 1):
	print(' ' * (w - len(str(i))) + str(i) + ' ' * (w - len(base10toN(i, 8)) + 1) + base10toN(i, 8) + ' ' * (w - len(base10toN(i, 16)) + 1) + base10toN(i, 16).upper() + ' ' * (w - len(base10toN(i, 2)) + 1) + base10toN(i, 2))


def print_table(n):
	width = len(bin(n)[2:]) + 1
	fns = [lambda x: oct(x)[2:], lambda x: hex(x)[2:].upper(), lambda x: bin(x)[2:]]
	for dec in range(1, n + 1):
		print(str(dec).rjust(width - 1) + ''.join((fn(dec).rjust(width) for fn in fns)))

def main():
	N = int(input())
	print_table(N)
	return 0
main()


N = int(input())
for i in range(1, N + 1):
	l = [str(i), str(oct(i))[2:], str(hex(i))[2:].upper(), str(bin(i))[2:]]
	format_string = '%' + str(len(str(bin(N))[2:])) + 's'
	for val in l:
		print(format_string % val, end=' ')
	print()


x = int(input())
l = len(bin(x)) - 2
s = ('{:>' + str(l) + '} ') * 4
for i in range(1, x + 1):
	print(s.format(str(i), oct(i)[2:], hex(i)[2:].upper(), bin(i)[2:]))