#include <bits/stdc++.h>
using namespace std;
int N;
void print(vector<int> v, bool prob) {
  if (v.empty()) {
    puts("NO");
  } else {
    for (int i = 1; i <= N; i++) {
      assert(v[i]);
      if (prob) {
        assert(v[i] != i && (v[i] & i) != 0);
      } else {
        assert(v[i] != i && (v[i] & i) == 0);
      }
    }
    puts("YES");
    for (int i = 1; i <= N; i++) {
      printf("%d ", v[i]);
    }
    puts("");
  }
}
void brute() {
  vector<int> perm(N + 1);
  iota((perm).begin(), (perm).end(), 0);
  vector<int> ans1, ans2;
  do {
    bool ok1 = true, ok2 = true;
    for (int i = 1; i <= N; i++) {
      if (!(perm[i] != i && (perm[i] & i) == 0)) {
        ok1 = false;
      }
      if (!(perm[i] != i && (perm[i] & i) != 0)) {
        ok2 = false;
      }
    }
    if (ans1.empty() && ok1) {
      ans1 = perm;
    }
    if (ans2.empty() && ok2) {
      ans2 = perm;
    }
    if (!ans1.empty() && !ans2.empty()) {
      break;
    }
  } while (next_permutation(perm.begin() + 1, perm.end()));
  print(ans1, false);
  print(ans2, true);
  exit(0);
}
void assign(vector<int> &ans, vector<int> cyc) {
  assert(cyc.size() > 1);
  for (int i = 0; i < cyc.size(); i++) {
    ans[cyc[i]] = cyc[(i + 1) % cyc.size()];
  }
}
vector<int> solve1() {
  if (N % 2) {
    return vector<int>();
  }
  vector<int> ans(N + 1);
  int cur = N;
  while (cur > 0) {
    int pwr2 = 1;
    while (pwr2 * 2 <= cur) {
      pwr2 *= 2;
    }
    for (int i = 1;; i++) {
      int nlt = pwr2 - i;
      int nrt = pwr2 + i - 1;
      if (nlt <= 0 || nrt > cur) {
        cur = nlt;
        break;
      }
      assign(ans, {nlt, nrt});
    }
  }
  return ans;
}
vector<int> solve2() {
  if ((N & (N - 1)) == 0) {
    return vector<int>();
  }
  vector<int> ans(N + 1);
  assign(ans, {2, 3});
  assign(ans, {4, 6, 5, 1, 7});
  for (int lt = 8; lt < N; lt *= 2) {
    int rt = min(N, lt * 2 - 1);
    vector<int> cyc(rt - lt + 1);
    iota((cyc).begin(), (cyc).end(), lt);
    assign(ans, cyc);
  }
  return ans;
}
int main() {
  scanf("%d", &N);
  if (N <= 8) {
    brute();
  }
  print(solve1(), false);
  print(solve2(), true);
}

### Prompt

Please formulate a Cpp solution to the following problem:

Given an integer N, find two permutations:

  1. Permutation p of numbers from 1 to N such that pi ≠ i and pi & i = 0 for all i = 1, 2, ..., N. 
  2. Permutation q of numbers from 1 to N such that qi ≠ i and qi & i ≠ 0 for all i = 1, 2, ..., N. 



& is the [bitwise AND operation](https://en.wikipedia.org/wiki/Bitwise_operation#AND).

Input

The input consists of one line containing a single integer N (1 ≤ N ≤ 105).

Output

For each subtask, if the required permutation doesn't exist, output a single line containing the word "NO"; otherwise output the word "YES" in the first line and N elements of the permutation, separated by spaces, in the second line. If there are several possible permutations in a subtask, output any of them.

Examples

Input

3


Output

NO
NO


Input

6


Output

YES
6 5 4 3 2 1 
YES
3 6 2 5 1 4

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
int N;
void print(vector<int> v, bool prob) {
  if (v.empty()) {
    puts("NO");
  } else {
    for (int i = 1; i <= N; i++) {
      assert(v[i]);
      if (prob) {
        assert(v[i] != i && (v[i] & i) != 0);
      } else {
        assert(v[i] != i && (v[i] & i) == 0);
      }
    }
    puts("YES");
    for (int i = 1; i <= N; i++) {
      printf("%d ", v[i]);
    }
    puts("");
  }
}
void brute() {
  vector<int> perm(N + 1);
  iota((perm).begin(), (perm).end(), 0);
  vector<int> ans1, ans2;
  do {
    bool ok1 = true, ok2 = true;
    for (int i = 1; i <= N; i++) {
      if (!(perm[i] != i && (perm[i] & i) == 0)) {
        ok1 = false;
      }
      if (!(perm[i] != i && (perm[i] & i) != 0)) {
        ok2 = false;
      }
    }
    if (ans1.empty() && ok1) {
      ans1 = perm;
    }
    if (ans2.empty() && ok2) {
      ans2 = perm;
    }
    if (!ans1.empty() && !ans2.empty()) {
      break;
    }
  } while (next_permutation(perm.begin() + 1, perm.end()));
  print(ans1, false);
  print(ans2, true);
  exit(0);
}
void assign(vector<int> &ans, vector<int> cyc) {
  assert(cyc.size() > 1);
  for (int i = 0; i < cyc.size(); i++) {
    ans[cyc[i]] = cyc[(i + 1) % cyc.size()];
  }
}
vector<int> solve1() {
  if (N % 2) {
    return vector<int>();
  }
  vector<int> ans(N + 1);
  int cur = N;
  while (cur > 0) {
    int pwr2 = 1;
    while (pwr2 * 2 <= cur) {
      pwr2 *= 2;
    }
    for (int i = 1;; i++) {
      int nlt = pwr2 - i;
      int nrt = pwr2 + i - 1;
      if (nlt <= 0 || nrt > cur) {
        cur = nlt;
        break;
      }
      assign(ans, {nlt, nrt});
    }
  }
  return ans;
}
vector<int> solve2() {
  if ((N & (N - 1)) == 0) {
    return vector<int>();
  }
  vector<int> ans(N + 1);
  assign(ans, {2, 3});
  assign(ans, {4, 6, 5, 1, 7});
  for (int lt = 8; lt < N; lt *= 2) {
    int rt = min(N, lt * 2 - 1);
    vector<int> cyc(rt - lt + 1);
    iota((cyc).begin(), (cyc).end(), lt);
    assign(ans, cyc);
  }
  return ans;
}
int main() {
  scanf("%d", &N);
  if (N <= 8) {
    brute();
  }
  print(solve1(), false);
  print(solve2(), true);
}

```