#include <bits/stdc++.h>
using namespace std;
int const bound = 1e6 + 2, N = 2e5 + 2;
long long OO = 1e18;
double eps = 1e-6;
int oo = 1e9, mod = oo + 9;
int n, aa[N];
void solve1() {
  if (n & 1) {
    cout << "NO\n";
    return;
  }
  memset(aa, 0, sizeof aa);
  for (int i = n; i > 0; i--) {
    if (aa[i]) continue;
    int cop = i, j = 0, res = 0;
    while (cop) {
      if (!(cop & 1)) res += 1 << j;
      cop >>= 1;
      j++;
    }
    aa[i] = res;
    aa[res] = i;
  }
  cout << "YES\n";
  for (int(i) = 1; (i) <= (n); (i)++) cout << aa[i] << ' ';
  cout << endl;
}
void solve2() {
  if (n <= 5 || bitset<20>(n).count() == 1) {
    cout << "NO\n";
    return;
  }
  int sub = 0;
  if (bitset<20>(n - 1).count() == 1) {
    aa[n] = n - 1;
    aa[n - 1] = n;
    n -= 2;
    sub = 2;
  }
  aa[2] = 3;
  aa[3] = 2;
  vector<int> ad;
  ad.push_back(1);
  for (int i = 5; i <= n; i += 2) ad.push_back(i);
  reverse(ad.begin(), ad.end());
  if ((int)ad.size() % 2) swap(ad[ad.size() / 2], ad[0]);
  for (int i = 1, j = 0; i <= n; i += 2) {
    if (aa[i]) continue;
    aa[i] = ad[j];
    j++;
  }
  ad.clear();
  vector<vector<int> > by;
  for (int i = 4, j = 3; i <= n; i += 2) {
    if ((1 << j) > i)
      ad.push_back(i);
    else {
      reverse(ad.begin(), ad.end());
      if ((int)ad.size() % 2) swap(ad[(int)ad.size() / 2], ad[0]);
      by.push_back(ad);
      j++;
      ad.clear();
      ad.push_back(i);
    }
  }
  reverse(ad.begin(), ad.end());
  if ((int)ad.size() % 2) swap(ad[(int)ad.size() / 2], ad[0]);
  by.push_back(ad);
  int w = 4;
  for (auto v : by)
    for (auto y : v) aa[w] = y, w += 2;
  cout << "YES\n";
  for (int(i) = 1; (i) <= (n + sub); (i)++) cout << aa[i] << ' ';
  cout << endl;
}
int main() {
  cin >> n;
  solve1();
  memset(aa, 0, sizeof aa);
  solve2();
  return 0;
}

### Prompt

Your task is to create 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 const bound = 1e6 + 2, N = 2e5 + 2;
long long OO = 1e18;
double eps = 1e-6;
int oo = 1e9, mod = oo + 9;
int n, aa[N];
void solve1() {
  if (n & 1) {
    cout << "NO\n";
    return;
  }
  memset(aa, 0, sizeof aa);
  for (int i = n; i > 0; i--) {
    if (aa[i]) continue;
    int cop = i, j = 0, res = 0;
    while (cop) {
      if (!(cop & 1)) res += 1 << j;
      cop >>= 1;
      j++;
    }
    aa[i] = res;
    aa[res] = i;
  }
  cout << "YES\n";
  for (int(i) = 1; (i) <= (n); (i)++) cout << aa[i] << ' ';
  cout << endl;
}
void solve2() {
  if (n <= 5 || bitset<20>(n).count() == 1) {
    cout << "NO\n";
    return;
  }
  int sub = 0;
  if (bitset<20>(n - 1).count() == 1) {
    aa[n] = n - 1;
    aa[n - 1] = n;
    n -= 2;
    sub = 2;
  }
  aa[2] = 3;
  aa[3] = 2;
  vector<int> ad;
  ad.push_back(1);
  for (int i = 5; i <= n; i += 2) ad.push_back(i);
  reverse(ad.begin(), ad.end());
  if ((int)ad.size() % 2) swap(ad[ad.size() / 2], ad[0]);
  for (int i = 1, j = 0; i <= n; i += 2) {
    if (aa[i]) continue;
    aa[i] = ad[j];
    j++;
  }
  ad.clear();
  vector<vector<int> > by;
  for (int i = 4, j = 3; i <= n; i += 2) {
    if ((1 << j) > i)
      ad.push_back(i);
    else {
      reverse(ad.begin(), ad.end());
      if ((int)ad.size() % 2) swap(ad[(int)ad.size() / 2], ad[0]);
      by.push_back(ad);
      j++;
      ad.clear();
      ad.push_back(i);
    }
  }
  reverse(ad.begin(), ad.end());
  if ((int)ad.size() % 2) swap(ad[(int)ad.size() / 2], ad[0]);
  by.push_back(ad);
  int w = 4;
  for (auto v : by)
    for (auto y : v) aa[w] = y, w += 2;
  cout << "YES\n";
  for (int(i) = 1; (i) <= (n + sub); (i)++) cout << aa[i] << ' ';
  cout << endl;
}
int main() {
  cin >> n;
  solve1();
  memset(aa, 0, sizeof aa);
  solve2();
  return 0;
}

```