Mrs. Smith is trying to contact her husband, John Smith, but she forgot the secret phone number!

The only thing Mrs. Smith remembered was that any permutation of $n$ can be a secret phone number. Only those permutations that minimize secret value might be the phone of her husband.

The sequence of $n$ integers is called a permutation if it contains all integers from $1$ to $n$ exactly once.

The secret value of a phone number is defined as the sum of the length of the longest increasing subsequence (LIS) and length of the longest decreasing subsequence (LDS). 

A subsequence $a_{i_1}, a_{i_2}, \ldots, a_{i_k}$ where $1\leq i_1 < i_2 < \ldots < i_k\leq n$ is called increasing if $a_{i_1} < a_{i_2} < a_{i_3} < \ldots < a_{i_k}$. If $a_{i_1} > a_{i_2} > a_{i_3} > \ldots > a_{i_k}$, a subsequence is called decreasing. An increasing/decreasing subsequence is called longest if it has maximum length among all increasing/decreasing subsequences.

For example, if there is a permutation $[6, 4, 1, 7, 2, 3, 5]$, LIS of this permutation will be $[1, 2, 3, 5]$, so the length of LIS is equal to $4$. LDS can be $[6, 4, 1]$, $[6, 4, 2]$, or $[6, 4, 3]$, so the length of LDS is $3$.

Note, the lengths of LIS and LDS can be different.

So please help Mrs. Smith to find a permutation that gives a minimum sum of lengths of LIS and LDS.


-----Input-----

The only line contains one integer $n$ ($1 \le n \le 10^5$) — the length of permutation that you need to build.


-----Output-----

Print a permutation that gives a minimum sum of lengths of LIS and LDS. 

If there are multiple answers, print any.


-----Examples-----
Input
4

Output
3 4 1 2

Input
2

Output
2 1



-----Note-----

In the first sample, you can build a permutation $[3, 4, 1, 2]$. LIS is $[3, 4]$ (or $[1, 2]$), so the length of LIS is equal to $2$. LDS can be ony of $[3, 1]$, $[4, 2]$, $[3, 2]$, or $[4, 1]$. The length of LDS is also equal to $2$. The sum is equal to $4$. Note that $[3, 4, 1, 2]$ is not the only permutation that is valid.

In the second sample, you can build a permutation $[2, 1]$. LIS is $[1]$ (or $[2]$), so the length of LIS is equal to $1$. LDS is $[2, 1]$, so the length of LDS is equal to $2$. The sum is equal to $3$. Note that permutation $[1, 2]$ is also valid.

Difficulty: competition

Starter code:

Solutions:
from math import sqrt
n = int(input())
k = int(sqrt(n))
b = []
last = 0
while last < n:
    b.append([last + j for j in range(k)])
    last = b[-1][-1] + 1
k = len(b)
for i in range(k - 1, -1, -1):
    for j in b[i]:
        if j < n:
            print(1 + j, end=' ')
print()


import math

n = int(input())
m = math.ceil(math.sqrt(n))
ans = []
for k in range(m):
    s = min((k + 1) * m, n)
    t = k * m
    ans.extend(list(range(s, t, -1)))
print(*ans)


n = int(input())

b = int(n ** 0.5)

ans = []
for i in range(0, n, b):
    ans = [j for j in range(i + 1, min(i + 1 + b, n + 1))] + ans

print(*ans)


#      
import collections, atexit, math, sys, bisect 

sys.setrecursionlimit(1000000)
def getIntList():
    return list(map(int, input().split()))    

try :
    #raise ModuleNotFoundError
    import numpy
    def dprint(*args, **kwargs):
        print(*args, **kwargs, file=sys.stderr)
    dprint('debug mode')
except ModuleNotFoundError:
    def dprint(*args, **kwargs):
        pass



inId = 0
outId = 0
if inId>0:
    dprint('use input', inId)
    sys.stdin = open('input'+ str(inId) + '.txt', 'r') #标准输出重定向至文件
if outId>0:
    dprint('use output', outId)
    sys.stdout = open('stdout'+ str(outId) + '.txt', 'w') #标准输出重定向至文件
    atexit.register(lambda :sys.stdout.close())     #idle 中不会执行 atexit
    
N, = getIntList()

for i in range(N+20):
    if i*i >N:
        break

x = i-1
if x*x !=N:
    x+=1
dprint(x)

t = N//x

res = []
for i in range(N- t*x):
    res.append(t*x+i+1)

for i in range(t-1,-1, -1):
    for j in range(x):
        res.append(i*x + j+1)

for x in res:
    print(x, end = ' ')









def ii():
    return int(input())
def mi():
    return list(map(int, input().split()))
def li():
    return list(mi())

n = ii()
m = int(n ** 0.5)

a = [0] * n
c = 0
for i in range(10 ** 7):
    s = min(n, m * (i + 1))
    for j in range(m):
        a[c] = s
        s -= 1
        c += 1
        if c >= n: break
    if c >= n: break
print(*a)


import math
n = int(input())
tmp = int(math.sqrt(n))
l, r = max(1, n-tmp+1), n
while True:
    for i in range(l, r+1):
        print(i, end=' ')
    if l == 1:
        break
    l, r = max(1, l-tmp), l-1


import math
n=int(input())
if n<=3:
    for i in range(1,n+1):
        print(i,end=' ')
    return

start=int(math.sqrt(n))
sqrtVal=start
already=[False]*100005

if True:
    while start<=n:
        for i in range(sqrtVal):
            if already[start-i]:
                return
            print(start-i,end=' ')
            already[start-i]=True
        start+=sqrtVal
        start=min(start,n)

#list_int 並べて出力 print (' '.join(map(str,ans_li)))
#list_str 並べて出力 print (' '.join(list))

from collections import defaultdict
import sys,heapq,bisect,math,itertools,string,queue,datetime
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
AtoZ = [chr(i) for i in range(65,65+26)]
atoz = [chr(i) for i in range(97,97+26)]

def inpl(): return list(map(int, input().split()))
def inpl_s(): return list(input().split())

N = int(input())
k = int(math.sqrt(N-1))+1
ans = []
if N == 1:
	ans = [1]
elif N == 2:
	ans = [2,1]
elif N == 3:
	ans = [2,3,1]
else:
	while N > 0:
		li = []
		for i in range(k):
			if N > 0:
				li.append(N)
			N -= 1
		li.reverse()
		ans = ans + li

print(' '.join(map(str,ans)))


import math
n = int(input())
wk1 = math.floor(math.sqrt(n))
wk2 = n // wk1
for i in range(wk2 * (wk1), n):
    print(i + 1, end = " ")
for i in reversed(range(wk1)):
    for j in range(wk2 * i, wk2 * (i + 1)):
        print(j + 1, end = " ")
print()

USE_STDIO = False

if not USE_STDIO:
    try: import mypc
    except: pass

def main():
    n, = list(map(int, input().split(' ')))
    q = int(n ** 0.5)
    ans = [i for i in range(1, n+1)]
    for i in range(0, n, q):
        ans[i:i+q] = ans[i:i+q][::-1]
    print(*ans)

def __starting_point():
    main()




__starting_point()

3

import itertools


def main():
    N = int(input())

    bestv = 4 * N
    besti = -1

    for i in range(1, N + 1):
        v = i + (N + i - 1) // i
        if v < bestv:
            bestv = v
            besti = i

    A = []
    cur = N

    if N % besti > 0:
        a = [cur - j for j in range(N % besti)]
        a.reverse()
        A.append(a)
        cur -= N % besti

    while cur > 0:
        a = [cur - j for j in range(besti)]
        a.reverse()
        A.append(a)
        cur -= besti

    print(*list(itertools.chain.from_iterable(A)))


def __starting_point():
    main()

__starting_point()

import math

n=int(input())
x=math.ceil(math.sqrt(n))
y=n//x


for i in range(y):
    for j in range(x,0,-1):
        print(j+i*x,end=" ")

for i in range(n,x*(y),-1):
    print(i,end=" ")






from math import sqrt

n = int(input())

step = int(sqrt(n))
assert step**2 <= n and (step + 1)**2 > n
ans = []
for start in range(0, n, step):
    ans.extend(range(start, min(n, start + step))[::-1])
print(' '.join(str(v + 1) for v in ans))

from math import sqrt
n = int(input())
r = int(sqrt(n))
ans = []
if n == 1:
	print("1")
elif n == 2:
	print("1 2")
elif n == 3:
	print("1 3 2")
elif r ** 2 == n:
	for i in range(r):
		ans += [str((r - i - 1) * r + j) for j in range(1, r + 1)]
	print(" ".join(ans))
else:
	if n <= r * (r + 1):
		segment = r
		element = r + 1
	else:
		segment = r + 1
		element = r + 1
	for i in range(segment - 1):
		ans += [str(n - element * i - j) for j in range(element - 1, -1, -1)]
	ans += [str(j) for j in range(1, n - element * (segment - 1) + 1)]
	print(" ".join(ans))

n = int(input())
import math
d = int(math.sqrt(n))
for i in range(n // d):
    b = n - d * (i + 1) + 1
    for i in range(d):
        print(b, end = ' ')
        b += 1
a = 1
for i in range(n - d * (n // d)):
    print(a, end = ' ')
    a += 1


import math
n = int(input())
k = math.ceil(n**(0.5))
a = []
i = 1
while n - i*k > 0:
    for j in range(1,k+1):
        a.append(str(n - i*k + j))
    i += 1
for l in range(1,n - (i-1)*k+1):
    a.append(str(l))
print(" ".join(a))

n=int(input())
min1=1000000009
id=0
s=""
for i in range(1,n+1):
  m=(n+i-1)//i
  if (m+i)<min1:
    min1=m+i
    id=i
a=[]
for i in range(n,0,-1):
  a.append(i)
  if(len(a)==id):
    a.reverse()
    for j in range(len(a)):
      s+=str(a[j])+" "
    a.clear()
if(len(a)!=0):
  a.reverse()
  for j in range(len(a)):
    s+=str(a[j])+" "
  a.clear()
print(s)

  
  





from math import sqrt
n=int(input())
k=int(sqrt(n))
while(n):
    if n>k-1:
        for i in range(n-k+1,n+1):
            print(i,end=' ')
        n-=k
    if n!=0 and n<k:
        for i in range(1,n+1):
            print(i,end=' ')
        n=0
  


import math
n=int(input())
a=math.sqrt(n)
b=math.ceil(a)
a=math.floor(a)
if n-a*a<=a:
    for i in range(a):
        for j in range(a):
            print(a*(i+1)-j,end=' ')
    if b>a:
        k=n
        while k>=a*a+1:
            print(k,end=' ')
            k-=1
else:
    for i in range(a):
        for j in range(b):
            print(b*(i+1)-j,end=' ')
    if b>a:
        k=n
        while k>=a*b+1:
            print(k,end=' ')
            k-=1

from sys import stdin
from math import *

line = stdin.readline().rstrip().split()
n = int(line[0])
sizeG = int(floor(sqrt(n)))
cantG = int(ceil(n/sizeG))

for i in range(cantG-1):
    for j in range(sizeG, 0, -1):
        print(j+i*sizeG,end=" ")
for j in range(n, (cantG-1)*sizeG, -1):
    print(j, end=" ")

#for i in range(int(n/2)):
 #   print((i+1)*2, end=" ")
#for i in range(int(n/2)):
#    print((i+1)*2-1, end=" ")
#if n % 2==1:
#    print(n)

from math import ceil, floor

n = int(input())

k = floor(n ** .5)
tmp = [[j for j in range(i, min(k + i, n + 1))] for i in range(k * (n // k) + 1, 0, -k)]
answer = []
for item in tmp:
    answer += item
print(' '.join(str(item) for item in answer))


from math import sqrt, ceil
n = int(input())

n_sqrt = int(ceil(sqrt(n)))
ans = []
i = 1
while i <= n:
  ans = ans + list(range(i, min(i+n_sqrt, n+1)))[::-1]
  i += n_sqrt
print(" ".join(map(str, ans)))



n = int(input())

if n == 1:
    print(1)
else:
    chunkn = 2
    ans = (n + 1) // 2 + 2
    for curChunkn in range(3, n + 1):
        chunk = n // curChunkn
        curAns = chunk + curChunkn
        if n % curChunkn > 0:
            curAns += 1
        
        if curAns > ans:
            break
        ans = curAns
        chunkn = curChunkn
    
    lim = n
    left = n % chunkn
    for i in range(chunkn):
        start = lim - (n // chunkn) + 1
        if left > 0:
            left -= 1
            start -=1
        for j in range(start, lim + 1):
            print(j, end=' ')
        lim = start - 1
        

import math
def listsum(l):
  a = []
  for i in l:
    a = a+i
  return a

n = int(input())
m = math.ceil(math.sqrt(n))
a = [" ".join([str(m-i+x*m) for x in range(int((n-m+i)/m)+1)]) for i in range(m)]
print(" ".join(a))

import math

n = int(input())

t = range(1, n+1)

size = math.floor(math.sqrt(n))
ans = [list(t[i:i+size])[::-1] for i in range(0, n, size)]

for i in ans:
    for j in i:
        print(j,end=' ')
print(end='\n')