#include <bits/stdc++.h>
using namespace std;
void solve1(int N) {
  if (N % 2) {
    cout << "NO" << endl;
    return;
  }
  set<int> st;
  vector<int> ans(N + 1);
  int X = 1;
  while (N / X > 1) X *= 2;
  for (int i = 1; i <= N; i++) st.insert(i);
  while (st.size()) {
    int a = *st.rbegin();
    st.erase(a);
    while (a / X == 0) X /= 2;
    int b = (2 * X - 1) ^ a;
    ans[a] = b;
    ans[b] = a;
    st.erase(b);
  }
  cout << "YES" << endl;
  for (int i = 1; i <= N; i++) {
    cout << ans[i] << " \n"[i == N];
    assert((i & ans[i]) == 0);
  }
}
void solve2(int N) {
  int Norg = N;
  vector<int> ans(N + 1);
  int X = 1;
  while (N / X > 1) X *= 2;
  if (N % 2 == 0) {
    if (X == N) {
      cout << "NO" << endl;
      return;
    }
    ans[N - 1] = 1;
    ans[1] = N - 1;
    vector<int> st;
    for (int i = 2; i <= N; i++)
      if (i != N - 1) st.push_back(i);
    while (st.size()) {
      int a = st.back();
      st.pop_back();
      int b = st.back();
      st.pop_back();
      ans[a] = b;
      ans[b] = a;
    }
  } else {
    if (N <= 5) {
      cout << "NO" << endl;
      return;
    }
    if (X == N - 1) {
      ans[N] = N - 1;
      ans[N - 1] = N;
      N -= 2;
      X /= 2;
    }
    ans[1] = N;
    ans[N] = N - 2;
    ans[N - 2] = 1;
    vector<int> st;
    for (int i = 2; i < N; i++)
      if (i != N - 2) st.push_back(i);
    while (st.size()) {
      int a = st.back();
      st.pop_back();
      int b = st.back();
      st.pop_back();
      ans[a] = b;
      ans[b] = a;
    }
  }
  cout << "YES" << endl;
  for (int i = 1; i <= Norg; i++) {
    cout << ans[i] << " \n"[i == Norg];
    assert(i & ans[i]);
  }
}
int main() {
  int N;
  cin >> N;
  solve1(N);
  solve2(N);
  return 0;
}

### 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;
void solve1(int N) {
  if (N % 2) {
    cout << "NO" << endl;
    return;
  }
  set<int> st;
  vector<int> ans(N + 1);
  int X = 1;
  while (N / X > 1) X *= 2;
  for (int i = 1; i <= N; i++) st.insert(i);
  while (st.size()) {
    int a = *st.rbegin();
    st.erase(a);
    while (a / X == 0) X /= 2;
    int b = (2 * X - 1) ^ a;
    ans[a] = b;
    ans[b] = a;
    st.erase(b);
  }
  cout << "YES" << endl;
  for (int i = 1; i <= N; i++) {
    cout << ans[i] << " \n"[i == N];
    assert((i & ans[i]) == 0);
  }
}
void solve2(int N) {
  int Norg = N;
  vector<int> ans(N + 1);
  int X = 1;
  while (N / X > 1) X *= 2;
  if (N % 2 == 0) {
    if (X == N) {
      cout << "NO" << endl;
      return;
    }
    ans[N - 1] = 1;
    ans[1] = N - 1;
    vector<int> st;
    for (int i = 2; i <= N; i++)
      if (i != N - 1) st.push_back(i);
    while (st.size()) {
      int a = st.back();
      st.pop_back();
      int b = st.back();
      st.pop_back();
      ans[a] = b;
      ans[b] = a;
    }
  } else {
    if (N <= 5) {
      cout << "NO" << endl;
      return;
    }
    if (X == N - 1) {
      ans[N] = N - 1;
      ans[N - 1] = N;
      N -= 2;
      X /= 2;
    }
    ans[1] = N;
    ans[N] = N - 2;
    ans[N - 2] = 1;
    vector<int> st;
    for (int i = 2; i < N; i++)
      if (i != N - 2) st.push_back(i);
    while (st.size()) {
      int a = st.back();
      st.pop_back();
      int b = st.back();
      st.pop_back();
      ans[a] = b;
      ans[b] = a;
    }
  }
  cout << "YES" << endl;
  for (int i = 1; i <= Norg; i++) {
    cout << ans[i] << " \n"[i == Norg];
    assert(i & ans[i]);
  }
}
int main() {
  int N;
  cin >> N;
  solve1(N);
  solve2(N);
  return 0;
}

```