John Doe has found the beautiful permutation formula.

Let's take permutation *p* = *p*<sub class="lower-index">1</sub>, *p*<sub class="lower-index">2</sub>, ..., *p*<sub class="lower-index">*n*</sub>. Let's define transformation *f* of this permutation: 

where *k* (*k* &gt; 1) is an integer, the transformation parameter, *r* is such maximum integer that *rk* ≤ *n*. If *rk* = *n*, then elements *p*<sub class="lower-index">*rk* + 1</sub>, *p*<sub class="lower-index">*rk* + 2</sub> 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.
A single line contains integer *n* (2 ≤ *n* ≤ 10<sup class="upper-index">6</sup>).
def f(p, k):
    result = []
    for x in range(len(p) // k):
        result.append(p[x * k + 1:(x + 1) * k])
        result.append([p[x * k]])
    result.append(p[(len(p) // k) * k + 1:])
    if (len(p) // k) * k < len(p):
        result.append([p[(len(p) // k) * k]])
    merged = []
    for r in result:
        merged += r
    return merged


class CodeforcesTask286BSolution:
    def __init__(self):
        self.result = ''
        self.n = 0

    def read_input(self):
        self.n = int(input())

    def process_task(self):
        if self.n == 2:
            self.result = "2 1"
        elif self.n == 3:
            self.result = "1 3 2"
        else:
            a0 = [x + 1 for x in range(self.n)]
            a1 = f(a0, 2)
            a2 = f(a1, self.n - 1)
            a3 = f(a2, self.n)
            for x in a3:
                print(x, end=" ")

    def get_result(self):
        return self.result


if __name__ == "__main__":
    Solution = CodeforcesTask286BSolution()
    Solution.read_input()
    Solution.process_task()
    print(Solution.get_result())
