Petya studies positional notations. He has already learned to add and subtract numbers in the systems of notations with different radices and has moved on to a more complicated action — multiplication. To multiply large numbers one has to learn the multiplication table. Unfortunately, in the second grade students learn only the multiplication table of decimals (and some students even learn it in the first grade). Help Petya make a multiplication table for numbers in the system of notations with the radix k.

Input

The first line contains a single integer k (2 ≤ k ≤ 10) — the radix of the system.

Output

Output the multiplication table for the system of notations with the radix k. The table must contain k - 1 rows and k - 1 columns. The element on the crossing of the i-th row and the j-th column is equal to the product of i and j in the system of notations with the radix k. Each line may have any number of spaces between the numbers (the extra spaces in the samples are put for clarity).

Examples

Input

10


Output

1  2  3  4  5  6  7  8  9
2  4  6  8 10 12 14 16 18
3  6  9 12 15 18 21 24 27
4  8 12 16 20 24 28 32 36
5 10 15 20 25 30 35 40 45
6 12 18 24 30 36 42 48 54
7 14 21 28 35 42 49 56 63
8 16 24 32 40 48 56 64 72
9 18 27 36 45 54 63 72 81


Input

3


Output

1  2
2 11

Difficulty: EASY
Tags: Implementation

Starter code:

Solutions:
k = int(input())
for i in range(1, k):
	(z, a) = (i, [])
	for j in range(k - 1):
		(p, s) = (z, '')
		while p:
			s = str(p % k) + s
			p //= k
		z += i
		a.append(s)
	print(*a)


def baseN(num, b, numerals='0123456789abcdefghijklmnopqrstuvwxyz'):
	return num == 0 and numerals[0] or baseN(num // b, b, numerals).lstrip(numerals[0]) + numerals[num % b]
n = int(input())
for i in range(1, n):
	for j in range(1, n):
		print(baseN(i * j, n), end=' ')
	print()


def toSys(n, k):
	res = ''
	t = k
	while n != 0:
		res += str(n % t)
		n //= t
		t *= k
	return res[::-1]
n = int(input())
for i in range(1, n):
	for j in range(1, n):
		print(toSys(i * j, n), end=' ')
	print()


a = int(input())

def radix(x):
	k = []
	while x:
		k.append(x % a)
		x = x // a
	return ''.join(map(str, k))[::-1]
for i in range(1, a):
	for j in range(1, a):
		print(radix(i * j), end=' ')
	print()


from sys import stdout, stdin, setrecursionlimit
from io import BytesIO, IOBase
from collections import *
from itertools import *
from random import *
from bisect import *
from string import *
from queue import *
from heapq import *
from math import *
from re import *
from os import *

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = read(self._fd, max(fstat(self._fd).st_size, 8192))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = read(self._fd, max(fstat(self._fd).st_size, 8192))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(stdin, stdout) = (IOWrapper(stdin), IOWrapper(stdout))
(graph, mod, szzz) = ({}, 10 ** 9 + 7, lambda : sorted(zzz()))

def getStr():
	return input()

def getInt():
	return int(input())

def listStr():
	return list(input())

def getStrs():
	return input().split()

def isInt(s):
	return '0' <= s[0] <= '9'

def input():
	return stdin.readline().strip()

def zzz():
	return [int(i) for i in input().split()]

def output(answer, end='\n'):
	stdout.write(str(answer) + end)

def lcd(xnum1, xnum2):
	return xnum1 * xnum2 // gcd(xnum1, xnum2)

def lcm(xnum1, xnum2):
	return xnum1 * xnum2 // gcd(xnum1, xnum2)
dx = [-1, 1, 0, 0, 1, -1, 1, -1]
dy = [0, 0, 1, -1, 1, -1, -1, 1]
daysInMounth = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]

def solve(n, k):
	ans = ''
	while n != 0:
		ans += str(n % k)
		n //= k
	return ans[::-1]
n = getInt() - 1
lst = [[0 for i in range(n)] for i in range(n)]
for i in range(n):
	for j in range(n):
		lst[i][j] = solve((i + 1) * (j + 1), n + 1)
for i in lst:
	print(*i)


def convert_base(number, base):
	if base < 2:
		return False
	remainders = []
	while number > 0:
		remainders.append(str(number % base))
		number //= base
	remainders.reverse()
	return ''.join(remainders)
n = int(input())
for i in range(1, n):
	s = ''
	for j in range(1, n):
		s += str(convert_base(i * j, n)) + ' '
	s = s[:-1]
	print(s)


n = int(input())
for i in range(1, n):
	print(*(i * j // n * 10 + i * j % n for j in range(1, n)))


k = int(input())

def convert_to_base_10(a):
	res = []
	while a:
		res.append(a % k)
		a //= k
	return ''.join(map(str, res[::-1]))
for i in range(1, k):
	output = []
	for j in range(1, k):
		output.append(convert_to_base_10(i * j))
	print(*output)


n = int(input())
f = lambda x: x if x < n else f(x // n) * 10 + x % n
for i in range(1, n):
	print(*[f(i * j) for j in range(1, n)])


def turn(i, j, k):
	p = i * j
	ans = ''
	while p > 0:
		t = p % k
		ans += str(t)
		p //= k
	return ans[::-1]
k = int(input())
for i in range(1, k):
	t = []
	for j in range(1, k):
		t.append(turn(i, j, k))
	print(*t, sep=' ')


radix = int(input())
for i in range(1, radix):
	row = []
	for j in range(1, radix):
		x = i * j
		digits = []
		while x != 0:
			digits.append(str(x % radix))
			x //= radix
		row.append(''.join(reversed(digits)))
	print(' '.join(row))


def b(n, k):
	v = ''
	while n:
		(n, v) = (n // k, str(n % k) + v)
	return v
k = int(input())
for i in range(1, k):
	print(' '.join((b(i * j, k) for j in range(1, k))))


n = int(input())
for i in range(1, n):
	for j in range(1, n):
		c = i * j
		d = []
		while c != 0:
			d.append(str(c % n))
			c = int(c / n)
		d.reverse()
		d = ''.join(d)
		print(d, end=' ')
	print()


k = int(input())
a = [[1] + [' ' * (len(str(k ** 2)) - 1 - len(str(i))) + str(i) for i in range(2, k)]] + [[i + 1] + [0 for j in range(k - 2)] for i in range(1, k - 1)]
for i in range(2, k):
	for j in range(2, k):
		b = i * j
		c = ''
		while b > 0:
			c += str(b % k)
			b //= k
		c = ' ' * (len(str(k ** 2)) - 1 - len(c)) + c[::-1]
		a[i - 1][j - 1] = c
for i in range(k - 1):
	print(*a[i])


from sys import stdout
from sys import stdin

def get():
	return stdin.readline().strip()

def getf():
	return [int(i) for i in get().split()]

def put(a, end='\n'):
	stdout.write(str(a) + end)

def putf(a, sep=' ', end='\n'):
	stdout.write(sep.join(map(str, a)) + end)

def matrix(n, m, a=0):
	return [[a for i in range(m)] for j in range(n)]

def transf(a, k):
	s = ''
	while a >= k:
		s += str(a % k)
		a //= k
	s += str(a)
	return s[::-1]

def main():
	n = int(get())
	t = matrix(n - 1, n - 1)
	for i in range(1, n):
		for j in range(1, n):
			t[i - 1][j - 1] = transf(i * j, n)
	for i in t:
		putf(i)
main()


def convert(n, base):
	x = ''
	while n > 0:
		x += str(n % base)
		n //= base
	return x[::-1]

def func(x, n):
	ans = []
	ans.append(x)
	for i in range(2, n):
		ans.append(int(convert(x * i, n)))
	return ans
n = int(input())
ans = []
for i in range(1, n):
	if i == 1:
		x = [j for j in range(1, n)]
		ans.append(x)
	else:
		x = func(i, n)
		ans.append(x)
for s in ans:
	print(*s)


def baseNum(a, b):
	i = 0
	sumV = []
	while a > 0:
		sumV.append(str(a % b))
		a = int(a / b)
		i += 1
	res = sumV[::-1]
	res2 = ''.join(res)
	res2 = int(res2)
	return res2
k = int(input())
for i in range(1, k):
	for j in range(1, k):
		print(baseNum(i * j, k), end=' ')
	print(end='\n')