Leha like all kinds of strange things. Recently he liked the function F(n, k). Consider all possible k-element subsets of the set [1, 2, ..., n]. For subset find minimal element in it. F(n, k) — mathematical expectation of the minimal element among all k-element subsets.

But only function does not interest him. He wants to do interesting things with it. Mom brought him two arrays A and B, each consists of m integers. For all i, j such that 1 ≤ i, j ≤ m the condition A_{i} ≥ B_{j} holds. Help Leha rearrange the numbers in the array A so that the sum $\sum_{i = 1}^{m} F(A_{i}^{\prime}, B_{i})$ is maximally possible, where A' is already rearranged array.


-----Input-----

First line of input data contains single integer m (1 ≤ m ≤ 2·10^5) — length of arrays A and B.

Next line contains m integers a_1, a_2, ..., a_{m} (1 ≤ a_{i} ≤ 10^9) — array A.

Next line contains m integers b_1, b_2, ..., b_{m} (1 ≤ b_{i} ≤ 10^9) — array B.


-----Output-----

Output m integers a'_1, a'_2, ..., a'_{m} — array A' which is permutation of the array A.


-----Examples-----
Input
5
7 3 5 3 4
2 1 3 2 3

Output
4 7 3 5 3

Input
7
4 6 5 8 8 2 6
2 1 2 2 1 1 2

Output
2 6 4 5 8 8 6

Difficulty: competition

Starter code:

Solutions:
"""
    Author      : Arif Ahmad
    Date        : 
    Algo        : 
    Difficulty  : 
"""
from sys import stdin, stdout, setrecursionlimit
import threading


def main():
    m = int(stdin.readline().strip())
    a = [int(_) for _ in stdin.readline().strip().split()]
    b = [int(_) for _ in stdin.readline().strip().split()]

    c = []
    for i, v in enumerate(b):
        c.append((v, i))

    a = sorted(a, reverse=True)
    c = sorted(c)

    ans = [0 for i in range(m)]
    j = 0
    for v, i in c:
        ans[i] = a[j]
        j += 1

    stdout.write(' '.join(str(_) for _ in ans))
    


def __starting_point():
    # the following 4 lines of code are required to increase 
    # the recursion limit and stack size
    # * if is cause any problem, comment out the lines, 
    # * and just call main()
    setrecursionlimit(10**6)
    threading.stack_size(134217728) # 128MB
    thread = threading.Thread(target=main)
    thread.start()

__starting_point()

n=int(input())
a=list(map(int,input().strip().split(' ')))
b=list(map(int,input().strip().split(' ')))
c=[]
a.sort(reverse=True)
for i in range(n):
    d=[]
    d.append(b[i])
    d.append(i)
    c.append(d)
c = sorted(c)
d=[0 for i in range(n)]
for i in range(n):
    d[c[i][1]]=a[i]
for i in range(n):
    print(d[i],end=' ')

n=int(input())
a=list(map(int,input().strip().split(' ')))
b=list(map(int,input().strip().split(' ')))
c=[]
a.sort(reverse=True)
for i in range(n):
    d=[]
    d.append(b[i])
    d.append(i)
    c.append(d)
c = sorted(c)
d=[0 for i in range(n)]
for i in range(n):
    d[c[i][1]]=a[i]
for i in range(n):
    print(d[i],end=' ')

n=int(input())
a=list(map(int,input().strip().split(' ')))
b=list(map(int,input().strip().split(' ')))
c=[]
a.sort(reverse=True)
for i in range(n):
    d=[]
    d.append(b[i])
    d.append(i)
    c.append(d)
c = sorted(c, key=lambda x: (x[0], -x[1]))
d=[0 for i in range(n)]
for i in range(n):
    d[c[i][1]]=a[i]
for i in range(n):
    print(d[i],end=' ')

n = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

A.sort(reverse=True)
B1 = sorted(enumerate(B), key=lambda x: x[1])
B2 = sorted(enumerate(B1), key=lambda x: x[1])

ans = [A[b[0]] for b in B2]

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


n = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

A.sort(reverse=True)
B1 = sorted(enumerate(B), key=lambda x: x[1])
B2 = sorted(enumerate(B1), key=lambda x: x[1])

ans = [A[b[0]] for b in B2]

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


m = int(input())
A = sorted(list(map(int, input().split())))
B = list(map(int, input().split()))

B_idx = sorted([(v, i) for (i, v) in enumerate(B)], reverse=True)
for i in range(m):
    B[B_idx[i][1]] = A[i]
print(" ".join([str(v) for v in B]))



# http://codeforces.com/problemset/problem/840/A
class Element(object):
    def __init__(self, val, index, asigned=-1):
        self.val = val
        self.index = index
        self.asigned = asigned

def main():
    n = int(input())
    a = list(map(int, input().split()))
    b = list(map(int, input().split()))
    b_el = [Element(0, 0) for i in range(n)]

    for i in range(0, n):
        b_el[i].val = b[i]
        b_el[i].index = i
    # sort a by vals
    a = sorted(a)
    # sort b by vals
    b_el = sorted(b_el, key=lambda x: x.val)
    # asigna valores mayores a los menores
    for i in range(0, n):
        b_el[i].asigned = a[n - 1 - i]
    # reordenar b, esta vez por indices y print de valores asignados
    b_el = sorted(b_el, key=lambda x: x.index)
    for i in b_el:
        print(i.asigned, end=' ')
main()


def getSum(a, b):
    
    cont = 0
    for i in range(0, len(a)):
        cont += (a[i] + 1) / (b[i] + 1)
    
    return cont
    
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

ordenadoB = []
ordenadoA = []
for i in range(0, len(a)):
    ordenadoB.append((i, b[i]))
    ordenadoA.append((i, a[i]))

ordenadoB = sorted(ordenadoB, key=lambda x: x[1])
ordenadoA = sorted(ordenadoA, key=lambda x: x[1], reverse=True)

res = []
# print(ordenadoB, ordenadoA)
for i in range(0, len(ordenadoA)):
    res.append( (ordenadoB[i][0], ordenadoA[i][1]))

res = sorted(res, key=lambda x: x[0])
for i in res:
    print(i[1], end=" ")
    
print('')
    

m = int(input())
a = sorted(map(int, input().split()), reverse=True)
b = sorted((bi, i) for i, bi in enumerate(map(int, input().split())))
v = [None] * m
for i in range(m):
    v[b[i][1]] = str(a[i])
print(' '.join(v))

n = int(input())
a = list(map(int, input().split()))
b = list([(int(x[1]), x[0]) for x in enumerate(input().split())])
res = [0]*n
a.sort(reverse=True)
b.sort()
for i in range(n):
    res[b[i][1]] = a[i]
print(" ".join(map(str, res)))


R=lambda:map(int,input().split())
n=int(input())
a=sorted(R())
c=[0]*n
for i,(_,j) in enumerate(sorted(zip(R(),range(n)))):
  c[j]=a[-1-i]
print(' '.join(map(str,c)))

def main():
    n = int(input())
    aa = sorted(map(int, input().split()), reverse=True)
    bb = list(map(int, input().split()))
    ij = sorted(list(range(n)), key=bb.__getitem__)
    for i, j in enumerate(ij):
        bb[j] = aa[i]
    print(' '.join(map(str, bb)))


def __starting_point():
    main()

__starting_point()

m = int(input())

a = list(map(int, input().split()))
b = list(zip(list(map(int, input().split())), list(range(m))))

a.sort(reverse=True)
b.sort()

c = list(zip((t[1] for t in b), a))
c.sort()

print(*(t[1] for t in c))



# Made By Mostafa_Khaled


n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
p =[]
for i in range(n):
    p.append((b[i],i+1));
#print(p)
p.sort()
#print(p)
a.sort()
#print(a)
a.reverse()
#print(a)
c = [0]*(n+1)
for i in range(n):
    #print(p[i][1],a[i])
    c[p[i][1]]=a[i]
for i in range(n):
    print(c[i+1],end=" ")


n = int(input())
inp = lambda : [*list(map(int, input().split()))]
a = sorted(inp(), reverse = True)
b = inp()
c = sorted([(i, b[i]) for i in range(n)], key = lambda x : x[1])
ans = [""] * n
for i in range(n):
    ans[c[i][0]] = str(a[i])
print(" ".join(ans))




n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = []
for i in range(n):
    c.append([b[i], i])
c = sorted(c)
a = sorted(a)
p = [0] * n
for x in range(n):
    p[c[x][1]] = a[n-x-1]
for i in range(n):
    print(p[i], end = ' ')

n = int(input())
a = sorted(list(map(int, input().split())), reverse = True)
b = list(map(int, input().split()))
c = sorted([(i, b[i]) for i in range(n)], key = lambda x : x[1])
res = [0] * n
for i in range(n):
    res[c[i][0]] = a[i]
print(*res)


import sys,math,string,bisect
input=sys.stdin.readline
from collections import deque
L=lambda : list(map(int,input().split()))
Ls=lambda : list(input().split())
M=lambda : list(map(int,input().split()))
I=lambda :int(input())
n=I()
l=L()
m=L()
x=[]
for i in range(n):
    x.append([-m[i],i])
x.sort(key=lambda x:x[0])
x=x[-1::-1]
l.sort(reverse=True)
d=[0]*n
for i in range(n):
    d[x[i][1]]=l[i]
print(*d)



import math
from collections import deque, defaultdict
from sys import stdin, stdout
input = stdin.readline
# print = stdout.write
listin = lambda : list(map(int, input().split()))
mapin = lambda : map(int, input().split())
m = int(input())
a = listin()
b = listin()
d = defaultdict(list)
for i in range(m):
    d[b[i]].append(i)
nums = deque(sorted(d.keys()))
a.sort(reverse = True)
a = deque(a)
ans = [0 for i in range(m)]
while nums:
    while d[nums[0]]:
        ans[d[nums[0]].pop()] = a.popleft()
    nums.popleft()
print(*ans)

import math
from collections import deque, defaultdict
from sys import stdin, stdout
input = stdin.readline
# print = stdout.write
listin = lambda : list(map(int, input().split()))
mapin = lambda : map(int, input().split())
m = int(input())
a = listin()
b = listin()
d = defaultdict(list)
for i in range(m):
    d[b[i]].append(i)
nums = deque(sorted(d.keys()))
a.sort(reverse = True)
a = deque(a)
ans = [0 for i in range(m)]
while nums:
    while d[nums[0]]:
        ans[d[nums[0]].pop()] = a.popleft()
    nums.popleft()
print(*ans)

import math


def bcof(x, y):
    a = math.factorial(x)
    b = math.factorial(y)
    c = math.factorial(x - y)  # that appears to be useful to get the correct result
    return a // (b * c)


def F(n, k):
    return bcof(n + 1, k + 1)


class CodeforcesTask840ASolution:
    def __init__(self):
        self.result = ''
        self.m = 0
        self.a = []
        self.b = []

    def read_input(self):
        self.m = int(input())
        self.a = [int(x) for x in input().split(" ")]
        self.b = [int(x) for x in input().split(" ")]

    def process_task(self):
        b = [(i, x) for i, x in enumerate(self.b)]
        b.sort(key=lambda tup: tup[1])
        self.a.sort(reverse=True)
        new_a = [0 for x in range(len(b))]
        for x in range(len(b)):
            new_a[b[x][0]] = self.a[x]
        self.result = " ".join([str(x) for x in new_a])

    def get_result(self):
        return self.result


def __starting_point():
    Solution = CodeforcesTask840ASolution()
    Solution.read_input()
    Solution.process_task()
    print(Solution.get_result())

__starting_point()

from operator import itemgetter
n, d = int(input()), {}
a, b = sorted(map(int, input().split()), reverse=True), sorted(sorted(enumerate(map(int, input().split())), reverse=True), key=itemgetter(1))
for i in range(n):
    d[b[i][0]] = a[i]
for i in range(n):
    print(d[i], end=' ')


ii = lambda: int(input())
mi = lambda: list(map(int, input().split()))
li = lambda: list(mi())
si = lambda: input()
msi = lambda: list(map(int, stdin.readline().split()))
lsi = lambda: list(msi())


m = int(input())
 
a = list(map(int, input().split()))
b = list(zip(list(map(int, input().split())), list(range(m))))
 
a.sort(reverse=True)
b.sort()
 
c = list(zip((t[1] for t in b), a))
c.sort()
 
print(*(t[1] for t in c))


import sys

num_n = int(sys.stdin.readline())
A = [int(x) for x in sys.stdin.readline()[:-1].split(" ")]
B = [int(x) for x in sys.stdin.readline()[:-1].split(" ")]
B1 = B.copy()

A.sort()
B.sort()

umap = {}

for num in B:
	if num in umap:
		umap[num].append(A.pop())
	else:
		umap[num] = list([A.pop()])

for num in B1:
	print(umap[num].pop(), end=' ')