Let's define the sum of two permutations p and q of numbers 0, 1, ..., (n - 1) as permutation <image>, where Perm(x) is the x-th lexicographically permutation of numbers 0, 1, ..., (n - 1) (counting from zero), and Ord(p) is the number of permutation p in the lexicographical order.

For example, Perm(0) = (0, 1, ..., n - 2, n - 1), Perm(n! - 1) = (n - 1, n - 2, ..., 1, 0)

Misha has two permutations, p and q. Your task is to find their sum.

Permutation a = (a0, a1, ..., an - 1) is called to be lexicographically smaller than permutation b = (b0, b1, ..., bn - 1), if for some k following conditions hold: a0 = b0, a1 = b1, ..., ak - 1 = bk - 1, ak < bk.

Input

The first line contains an integer n (1 ≤ n ≤ 200 000).

The second line contains n distinct integers from 0 to n - 1, separated by a space, forming permutation p.

The third line contains n distinct integers from 0 to n - 1, separated by spaces, forming permutation q.

Output

Print n distinct integers from 0 to n - 1, forming the sum of the given permutations. Separate the numbers by spaces.

Examples

Input

2
0 1
0 1


Output

0 1


Input

2
0 1
1 0


Output

1 0


Input

3
1 2 0
2 1 0


Output

1 0 2

Note

Permutations of numbers from 0 to 1 in the lexicographical order: (0, 1), (1, 0).

In the first sample Ord(p) = 0 and Ord(q) = 0, so the answer is <image>.

In the second sample Ord(p) = 0 and Ord(q) = 1, so the answer is <image>.

Permutations of numbers from 0 to 2 in the lexicographical order: (0, 1, 2), (0, 2, 1), (1, 0, 2), (1, 2, 0), (2, 0, 1), (2, 1, 0).

In the third sample Ord(p) = 3 and Ord(q) = 5, so the answer is <image>.
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.BitSet;
import java.util.Collections;
import java.util.Comparator;
import java.util.LinkedList;
import java.util.List;
import java.util.Queue;
import java.util.TreeSet;
public class Main {
	public static void main(String[] args) throws NumberFormatException, IOException{
		ContestScanner in = new ContestScanner();
		int n = in.nextInt();
		int[] p = new int[n];
		int[] q = new int[n];
		for(int i=0; i<n; i++){
			p[i] = in.nextInt();
		}
		for(int i=0; i<n; i++){
			q[i] = in.nextInt();
		}
		int[] pord = ord(p, n);
		int[] qord = ord(q, n);
		List<Integer> x = new LinkedList<Integer>();
		int carry = 0;
		for(int i=1; i<n; i++){
			int a = pord[i-1] + qord[i-1] + carry;
			if(a >= i+1){
				a %= i+1;
				carry = 1;
			}else carry = 0;
			x.add(0, a);
		}
		BitSet bs = new BitSet(n);
		BIT bit = new BIT(n);
		bs.set(0, n);
		for(int i=0; i<n; i++){
			bit.add(i, 1);
		}
		StringBuilder sb = new StringBuilder();
		for(int i: x){
//			int idx = bs.nextSetBit(0);
			int idx = bit.find(i+1);
			bit.add(idx, -1);
//			while(i-- > 0) idx = bs.nextSetBit(idx+1);
			bs.clear(idx);
			sb.append(idx+" ");
//			System.out.print(idx+" ");
		}
		sb.append(bs.nextSetBit(0));
		System.out.println(sb.toString());
	}
	
	public static int[] ord(int[] p, int n){
		int[] res = new int[n-1];
		BIT bit = new BIT(n);
//		BitSet bs = new BitSet();
		bit.add(p[n-1], 1);
//		bs.set(p[n-1]);
		int j = 0;
		for(int i=n-2; i>=0; i--){
			res[j++] = bit.sum(p[i]);
			bit.add(p[i], 1);
		}
		return res;
	}
}

class BIT{
	int n;
	int[] bit;
	public BIT(int n){
		this.n = n;
		bit = new int[n+1];
	}
	
	void add(int idx, int val){
		for(int i=idx+1; i<=n; i+=i&(-i)) bit[i-1] += val;
	}
	
	int sum(int idx){
		int res = 0;
		for(int i=idx+1; i>0; i-=i&(-i)) res += bit[i-1];
		return res;
	}
	
	int find(int sum){
		// find minimum index which sum equals given value
		int low = 0;
		int up  = n;
		int tmp = -1;
		int oldIdx = -1;
		if(sum == 0) return 0;
		while(low < up){
			int mid = (low+up)/2;
			tmp = sum(mid);
			if(tmp < sum){
				if(oldIdx > 0 && low == mid) break;
				low = mid;
			}else{
				if(tmp == sum){
					oldIdx = mid;
				}
				up = mid;
			}
		}
		if(oldIdx > 0 && sum(oldIdx-1) == sum) oldIdx--;
		return oldIdx;
	}
}
//
//class Data{
//	String oldest;
//	String newN;
//	
//}

class MyComp implements Comparator<int[]>{
	public int compare(int[] a, int[] b) {
		return a[0] - b[0];
	}
}
//
//class Reverse implements Comparator<Integer>{
//	public int compare(Integer arg0, Integer arg1) {
//		return arg1 - arg0;
//	}
//}

class Node implements Comparable<Node>{
	int id;
	int qNum;
	int xor;
	List<Node> edge = new ArrayList<Node>();
	public Node(int id, int q, int xor){
		this.id = id;
		qNum = q;
		this.xor = xor;
	}
	public void createEdge(Node node){
		edge.add(node);
	}
	
	@Override
	public int compareTo(Node n) {
		return n.qNum - qNum;
	}
}
//
//
//class NodeW{
//	int id;
//	List<NodeW> edge = new ArrayList<NodeW>();
//	List<Integer> costList = new ArrayList<Integer>();
//	public NodeW(int id) {
//		this.id = id;
//	}
//	public void createEdge(NodeW node, int cost) {
//		edge.add(node);
//		costList.add(cost);
//	}
//}

class Range<T extends Comparable<T>> implements Comparable<Range<T>>{
	T start;
	T end;
	public Range(T start, T end){
		this.start = start;
		this.end = end;
	}
	public boolean inRange(T val){
		if(start.compareTo(val) <= 0 && end.compareTo(val) >= 0){
			return true;
		}
		return false;
	}
	public boolean isCommon(Range<T> range){
		if(inRange(range.start) || inRange(range.end) || range.inRange(start)){
			return true;
		}
		return false;
	}
	public Range<T> connect(Range<T> range){
		if(!isCommon(range)) return null;
		Range<T> res = new Range<T>(start.compareTo(range.start) <= 0 ? start : range.start,
				end.compareTo(range.end) >= 0 ? end : range.end);
		return res;
	}
	public boolean connectToThis(Range<T> range){
		if(!isCommon(range)) return false;
		start = start.compareTo(range.start) <= 0 ? start : range.start;
		end = end.compareTo(range.end) >= 0 ? end : range.end;
		return true;
	}
	@Override
	public int compareTo(Range<T> range) {
		int res = start.compareTo(range.start);
		if(res == 0) return end.compareTo(range.end);
		return res;
	}
	public String toString(){
		return "["+start+","+end+"]";
	}
}

class RangeSet<T extends Comparable<T>>{
	TreeSet<Range<T>> ranges = new TreeSet<Range<T>>();
	public void add(Range<T> range){
		Range<T> con = ranges.floor(range);
		if(con != null){
			if(con.connectToThis(range))
				range = con;
		}
		con = ranges.ceiling(range);
		while(con != null && range.connectToThis(con)){
			ranges.remove(con);
			con = ranges.ceiling(range);
		}
		ranges.add(range);
	}
	public String toString(){
		StringBuilder bld = new StringBuilder();
		for(Range<T> r: ranges){
			bld.append(r+"\n");
		}
		return bld.toString();
	}
}


class MyMath{
	public final static double PIhalf = Math.PI/2.0;
	public static double pAngle(double x, double y){
		// �x�N�g��(1, 0)��(x, y)�Ƃ̂Ȃ��p��Ԃ�(rad:0 to 2pi)
		if(x == 0){
			if(y == 0){
				System.err.println("pAngle error: zero vector.");
				return 0;
			}else if(y < 0){
				return PIhalf*3.0;
			}else{
				return PIhalf;
			}
		}
		double rad = Math.atan(y/x);
		if(rad < 0){
			rad += Math.PI*2.0;
		}
		return rad;
	}
	public static long fact(long n){
		long res = 1;
		while(n > 0){
			res *= n--;
		}
		return res;
	}
	public static long[][] pascalT(int n){
		long[][] tri = new long[n][];
		for(int i=0; i<n; i++){
			tri[i] = new long[i+1];
			for(int j=0; j<i+1; j++){
				if(j == 0 || j == i){
					tri[i][j] = 1;
				}else{
					tri[i][j] = tri[i-1][j-1] + tri[i-1][j];
				}
			}
		}
		return tri;
	}

	// �ő����
	static int gcd(int a, int b){
		return b == 0 ? a : gcd(b, a % b);
	}

	// �ŏ����{��
	static int lcm(int a, int b){
		return a * b / gcd(a, b);
	}
}

class ContestScanner{
	private BufferedReader reader;
	private String[] line;
	private int idx;
	public ContestScanner() throws FileNotFoundException{
		reader = new BufferedReader(new InputStreamReader(System.in));
	}

	public ContestScanner(String filename) throws FileNotFoundException{
		reader = new BufferedReader(new InputStreamReader(new FileInputStream(filename)));
	}
	
	public String nextToken() throws IOException{
		if(line == null || line.length <= idx){
			line = reader.readLine().trim().split(" ");
			idx = 0;
		}
		return line[idx++];
	}
	public long nextLong() throws IOException, NumberFormatException{
		return Long.parseLong(nextToken());
	}
	public int nextInt() throws NumberFormatException, IOException{
		return (int)nextLong();
	}
	public double nextDouble() throws NumberFormatException, IOException{
		return Double.parseDouble(nextToken());
	}
}