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 java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {

   private void solve() throws IOException {
      int n = ni();
      int a[] = new int[2 * n];
      for (int i = 0; i < n; ++i) {
         a[i] = i + 1;
      }

      for (int i = 0; i < n - 1; ++i) {
         int j = i;
         int put = 2 * i + 2;
         int t = a[j];
         while (put < i + n) {
            int tt = t;
            t = a[put];
            a[put] = tt;
            j = put;
            put += i + 2;
         }
         a[i + n] = t;
      }

      for (int i = n - 1; i < 2 * n - 1; ++i)
         pr(a[i] + " ");
   }

   public static void main(String[] args) {
      new Main().run();
   }

   public void run() {
      try {
         if (isFileIO) {
            pw = new PrintWriter(new File("output.out"));
            br = new BufferedReader(new FileReader("input.in"));
         } else {
            pw = new PrintWriter(System.out);
            br = new BufferedReader(new InputStreamReader(System.in));
         }
         solve();
         pw.close();
         br.close();
      } catch (IOException e) {
         System.err.println("IO Error");
      }
   }

   private int[] nia(int n) throws IOException {
      int arr[] = new int[n];
      for (int i = 0; i < n; ++i)
         arr[i] = Integer.parseInt(nextToken());
      return arr;
   }

   private int[] niam1(int n) throws IOException {
      int arr[] = new int[n];
      for (int i = 0; i < n; ++i)
         arr[i] = Integer.parseInt(nextToken()) - 1;
      return arr;
   }

   private long[] nla(int n) throws IOException {
      long arr[] = new long[n];
      for (int i = 0; i < n; ++i)
         arr[i] = Long.parseLong(nextToken());
      return arr;
   }

   private void pr(Object o) {
      pw.print(o);
   }

   private void prln(Object o) {
      pw.println(o);
   }

   private void prln() {
      pw.println();
   }

   int ni() throws IOException {
      return Integer.parseInt(nextToken());
   }

   long nl() throws IOException {
      return Long.parseLong(nextToken());
   }

   double nd() throws IOException {
      return Double.parseDouble(nextToken());
   }

   private String nextToken() throws IOException {
      while (tokenizer == null || !tokenizer.hasMoreTokens()) {
         tokenizer = new StringTokenizer(br.readLine());
      }

      return tokenizer.nextToken();
   }

   // private void qsort(int a[]) {
   // Random rand = new Random(271828182l);
   // qsort(a, 0, a.length, rand);
   // }
   //
   // private void qsort(int a[], int l, int r, Random rand) {
   // if (r - l <= 1)
   // return;
   //
   // if (r - l == 2) {
   // if (a[r - 1] < a[l]) {
   // int t = a[r - 1];
   // a[r - 1] = a[l];
   // a[l] = t;
   // }
   //
   // return;
   // }
   //
   // int x = a[rand.nextInt(r - l) + l];
   // int i = l, j = r - 1;
   // while (i < j) {
   // while (a[i] < x)
   // ++i;
   // while (a[j] > x)
   // --j;
   // if (i < j) {
   // int t = a[i];
   // a[i] = a[j];
   // a[j] = t;
   // ++i;
   // --j;
   // }
   // }
   //
   // qsort(a, l, j + 1, rand);
   // qsort(a, i, r, rand);
   // }

   private BufferedReader br;
   private StringTokenizer tokenizer;
   private PrintWriter pw;
   private final boolean isFileIO = false;
}