John Doe has found the beautiful permutation formula.

Let's take permutation p = p1, p2, ..., pn. Let's define transformation f of this permutation: 

<image>

where k (k > 1) is an integer, the transformation parameter, r is such maximum integer that rk ≤ n. If rk = n, then elements prk + 1, prk + 2 and so on are omitted. In other words, the described transformation of permutation p cyclically shifts to the left each consecutive block of length k and the last block with the length equal to the remainder after dividing n by k. 

John Doe thinks that permutation f(f( ... f(p = [1, 2, ..., n], 2) ... , n - 1), n) is beautiful. Unfortunately, he cannot quickly find the beautiful permutation he's interested in. That's why he asked you to help him.

Your task is to find a beautiful permutation for the given n. For clarifications, see the notes to the third sample.

Input

A single line contains integer n (2 ≤ n ≤ 106).

Output

Print n distinct space-separated integers from 1 to n — a beautiful permutation of size n.

Examples

Input

2


Output

2 1 


Input

3


Output

1 3 2 


Input

4


Output

4 2 3 1 

Note

A note to the third test sample: 

  * f([1, 2, 3, 4], 2) = [2, 1, 4, 3]
  * f([2, 1, 4, 3], 3) = [1, 4, 2, 3]
  * f([1, 4, 2, 3], 4) = [4, 2, 3, 1]
import static java.lang.Math.*;
import static java.math.BigInteger.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;

import java.io.*;

public class B {

	final static boolean autoflush = false;

	public B () {
		int N = sc.nextInt();
		sc = null;

		int [] P = new int [2*N];
		for (int i : req(1, N))
			P[i] = i;

		for (int k : req(2, N))
			for (int r : seq(0, (N-1)/k)) {
				int X = r*k + (k-1), Y = min(X+k, N+k-1);
				P[Y] = P[X];
			}

		int [] res = copyOfRange(P, N, 2*N);
		exit(res);
	}

	////////////////////////////////////////////////////////////////////////////////////

	static int [] rep(int N) { return rep(0, N); }
	static int [] rep(int S, int T) { int [] res = new int [max(T-S, 0)]; for (int i = S; i < T; ++i) res[i-S] = i; return res; }
	static int [] req(int S, int T) { return rep(S, T+1); }

	static int [] sep(int N) { return sep(0, N); }
	static int [] sep(int S, int T) { int [] res = new int [max(T-S, 0)]; for (int i = S; i < T; ++i) res[T-i-1] = i; return res; }
	static int [] seq(int S, int T) { return sep(S, T+1); }

	////////////////////////////////////////////////////////////////////////////////////

	/* Dear hacker, don't bother reading below this line, unless you want to help me debug my I/O routines :-) */

	static MyScanner sc = new MyScanner();

	static class MyScanner {
		public String next() {
			readToken();
			return new String(b, T[0], T[1] - T[0]);
		}

		public char nextChar() {
			readToken();
			return (char)b[T[0]];
		}

		public int nextInt() {
			return (int)nextLong();
		}

		public long nextLong() {
			readToken();
			return calc(T[0], T[1]);
		}

		public double nextDouble() {
			return Double.parseDouble(next());
		}

		public String nextLine() {
			readLine();
			return new String(b, T[0], T[1] - T[0]);
		}

		public String [] next(int N) {
			String [] res = new String [N];
			for (int i = 0; i < N; ++i)
				res[i] = next();
			return res;
		}

		public Integer [] nextInt(int N) {
			Integer [] res = new Integer [N];
			for (int i = 0; i < N; ++i)
				res[i] = nextInt();
			return res;
		}

		public Long [] nextLong(int N) {
			Long [] res = new Long [N];
			for (int i = 0; i < N; ++i)
				res[i] = nextLong();
			return res;
		}

		public Double [] nextDouble(int N) {
			Double [] res = new Double [N];
			for (int i = 0; i < N; ++i)
				res[i] = nextDouble();
			return res;
		}

		public String [] nextLine(int N) {
			String [] res = new String [N];
			for (int i = 0; i < N; ++i)
				res[i] = nextLine();
			return res;
		}

		public String [] nextStrings() {
			readLine();
			int s = T[0], c = 0;
			String [] res = new String[count(T[0], T[1])];
			for (int i = T[0]; i < T[1]; ++i)
				if (b[i] == SPACE) {
					res[c++] = new String(b, s, i - s);
					s = i+1;
				}
			res[c] = new String (b, s, T[1] - s);
			return res;
		}

		public char [] nextChars() {
			readToken();
			int c = 0;
			char [] res = new char[T[1] - T[0]];
			for (int i = T[0]; i < T[1]; ++i)
				res[c++] = (char)b[i];
			return res;
		}

		public Integer [] nextInts() {
			readLine();
			int s = T[0], c = 0;
			Integer [] res = new Integer[count(T[0], T[1])];
			for (int i = T[0]; i < T[1]; ++i)
				if (b[i] == SPACE) {
					res[c++] = (int)calc(s, i);
					s = i+1;
				}
			res[c] = (int)calc(s, T[1]);
			return res;
		}

		public Long [] nextLongs() {
			readLine();
			int s = T[0], c = 0;
			Long [] res = new Long[count(T[0], T[1])];
			for (int i = T[0]; i < T[1]; ++i)
				if (b[i] == SPACE) {
					res[c++] = calc(s, i);
					s = i+1;
				}
			res[c] = calc(s, T[1]);
			return res;
		}

		public Double [] nextDoubles() {
			readLine();
			int s = T[0], c = 0;
			Double [] res = new Double[count(T[0], T[1])];
			for (int i = T[0]; i < T[1]; ++i)
				if (b[i] == SPACE) {
					res[c++] = Double.parseDouble(new String(b, s, i - s));
					s = i+1;
				}
			res[c] = Double.parseDouble(new String(b, s, T[1] - s));
			return res;
		}

		String [][] nextStrings(int N) {
			String [][] res = new String [N][];
			for (int i = 0; i < N; ++i)
				res[i] = nextStrings();
			return res;
		}

		char [][] nextChars(int N) {
			char [][] res = new char [N][];
			for (int i = 0; i < N; ++i)
				res[i] = nextChars();
			return res;
		}

		Integer [][] nextInts(int N) {
			Integer [][] res = new Integer [N][];
			for (int i = 0; i < N; ++i)
				res[i] = nextInts();
			return res;
		}

		Long [][] nextLongs(int N) {
			Long [][] res = new Long [N][];
			for (int i = 0; i < N; ++i)
				res[i] = nextLongs();
			return res;
		}

		Double [][] nextDoubles(int N) {
			Double [][] res = new Double [N][];
			for (int i = 0; i < N; ++i)
				res[i] = nextDoubles();
			return res;
		}

		//////////////////////////////////////////////

		private final static int MAX_SZ = (int)5e7;
		private final byte [] b = new byte[MAX_SZ];
		private final int [] T = new int [2];
		private int cur = 0;

		MyScanner () {
			try {
				InputStream is = new BufferedInputStream(System.in);
				while (is.available() == 0)
					Thread.sleep(1);
				start();
				int off = 0, c;
				while ((c = is.read(b, off, MAX_SZ - off)) != -1)
					off += c;
			} catch (Exception e) {
				throw new Error(e);
			}
		}

		private void readLine() {
			int c;
			for (c = cur; b[c] != LF && b[c] != CR && b[c] != 0; ++c);
			T[0] = cur; T[1] = c;
			for (cur = c; b[cur] == LF || b[cur] == CR; ++cur);
		}

		private void readToken() {
			int c;
			for (c = cur; b[c] != SPACE && b[c] != LF && b[c] != CR && b[c] != 0; ++c);
			T[0] = cur; T[1] = c;
			for (cur = c; b[cur] == SPACE || b[cur] == LF || b[cur] == CR; ++cur);
		}

		private int count(int s, int e) {
			int cnt = 1;
			for (int i = s; i < e; ++i)
				if (b[i] == SPACE)
					++cnt;
			return cnt;
		}

		private long calc(int s, int e) {
			long res = 0, f = 1;
			for (int i = s; i < e; ++i)
				if (b[i] == '-')
					f = -1;
				else
					res = 10 * res + b[i] - '0';
			return res * f;
		}

		private static final char LF = '\n';
		private static final char CR = '\r';
		private static final char SPACE = ' ';
	}

	static void print (Object o, Object... a) {
		printDelim(" ", o, a);
	}

	static void cprint (Object o, Object... a) {
		printDelim("", o, a);
	}

	static void printDelim (String delim, Object o, Object... a) {
		pw.println(build(delim, o, a));
	}

	static void exit (Object o, Object... a) {
		print(o, a);
		exit();
	}

	static void exit() {
		pw.close();
		System.out.flush();
		System.err.println("------------------");
		System.err.println("Time: " + ((millis() - t) / 1000.0));
		System.exit(0);
	}

	static void NO() {
		throw new Error("NO!");
	}

	////////////////////////////////////////////////////////////////////////////////////

	static String build (String delim, Object o, Object... a) {
		StringBuilder b = new StringBuilder();
		append(b, o, delim);
		for (Object p : a)
			append(b, p, delim);
		return b.toString().trim();
	}

	static void append(StringBuilder b, Object o, String delim) {
		if (o.getClass().isArray()) {
			int L = java.lang.reflect.Array.getLength(o);
			for (int i : rep(L))
				append(b, java.lang.reflect.Array.get(o, i), delim);
		} else if (o instanceof Iterable<?>)
			for (Object p : (Iterable<?>)o)
				append(b, p, delim);
		else
			b.append(delim).append(o);
	}

	////////////////////////////////////////////////////////////////////////////////////

	static void statics() {
		abs(0);
		valueOf(0);
		asList(new Object [0]);
		reverseOrder();
	}

	public static void main (String[] args) {
		new B();
		exit();
	}

	static void start() {
		t = millis();
	}

	static java.io.PrintWriter pw = new java.io.PrintWriter(System.out, autoflush);

	static long t;

	static long millis() {
		return System.currentTimeMillis();
	}
}
