#include <bits/stdc++.h>
using namespace std;
bool checkAndNotZero(deque<long long> &p) {
  long long n = p.size() - 1;
  for (int i = 1; i <= n; i++) {
    if (p[i] == i) return false;
    if (p[i] <= 0 || p[i] > n) return false;
    if ((p[i] & i) == 0) return false;
  }
  return true;
}
bool checkAndZero(deque<long long> &p) {
  long long n = p.size() - 1;
  for (int i = 1; i <= n; i++) {
    if (p[i] == i) return false;
    if (p[i] <= 0 || p[i] > n) return false;
    if ((p[i] & i) != 0) return false;
  }
  return true;
}
deque<long long> getBruteNotZero(long long n) {
  deque<long long> p;
  for (long long i = 0; i < (long long)n; i++) p.push_back(i + 1);
  do {
    p.push_front(-1);
    if (checkAndNotZero(p)) return p;
    p.pop_front();
  } while (next_permutation(p.begin(), p.end()));
  return {};
}
bool isPowerOfTwo(long long n) {
  long long pot = 1;
  while (pot < n) pot *= 2;
  return pot == n;
}
deque<long long> generateNotZero(long long n) {
  if (n % 2 == 0) {
    if (!isPowerOfTwo(n)) {
      deque<long long> ans(n + 1, -1);
      for (int i = 2; i < n - 2; i += 2) {
        ans[i] = i + 1;
        ans[i + 1] = i;
      }
      ans[1] = n - 1;
      ans[n - 1] = 1;
      ans[n - 2] = n;
      ans[n] = n - 2;
      assert(checkAndNotZero(ans));
      return ans;
    } else {
      return {};
    }
  } else {
    if (n <= 5) {
      return {};
    } else {
      deque<long long> ans = getBruteNotZero(7);
      ans.resize(n + 1);
      for (int i = 8; i < n; i += 2) {
        ans[i] = i + 1;
        ans[i + 1] = i;
      }
      assert(checkAndNotZero(ans));
      return ans;
    }
  }
  return {};
}
long long binNegate(long long x, long long sz) { return ((1 << sz) - 1) & ~x; }
int getBit(long long mask, long long pos) { return (mask >> pos) & 1; }
deque<long long> generateZero(long long n) {
  if (n % 2 == 1) return {};
  if (isPowerOfTwo(n + 1)) return {};
  long long lastBit = 31 - __builtin_clz(n);
  set<long long> s;
  for (int i = n; i >= 1; i--) s.insert(i);
  deque<long long> ans(n + 1, -1);
  while (!s.empty()) {
    vector<long long> erased;
    for (long long x : s) {
      if (getBit(x, lastBit) == 1) {
        long long match = binNegate(x, lastBit + 1);
        assert(s.find(match) != s.end());
        ans[x] = match;
        ans[match] = x;
        erased.push_back(x);
        erased.push_back(match);
      }
    }
    for (long long x : erased) s.erase(x);
    lastBit--;
  }
  assert(checkAndZero(ans));
  return ans;
}
void printAnswer(deque<long long> ans) {
  if (ans.empty()) {
    cout << "NO\n";
  } else {
    long long n = ans.size() - 1;
    cout << "YES\n";
    for (int i = 1; i <= n; i++) {
      cout << ans[i] << " ";
    }
    cout << "\n";
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n;
  cin >> n;
  printAnswer(generateZero(n));
  printAnswer(generateNotZero(n));
  return 0;
}

### Prompt

Please provide a cpp coded solution to the problem described below:

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;
bool checkAndNotZero(deque<long long> &p) {
  long long n = p.size() - 1;
  for (int i = 1; i <= n; i++) {
    if (p[i] == i) return false;
    if (p[i] <= 0 || p[i] > n) return false;
    if ((p[i] & i) == 0) return false;
  }
  return true;
}
bool checkAndZero(deque<long long> &p) {
  long long n = p.size() - 1;
  for (int i = 1; i <= n; i++) {
    if (p[i] == i) return false;
    if (p[i] <= 0 || p[i] > n) return false;
    if ((p[i] & i) != 0) return false;
  }
  return true;
}
deque<long long> getBruteNotZero(long long n) {
  deque<long long> p;
  for (long long i = 0; i < (long long)n; i++) p.push_back(i + 1);
  do {
    p.push_front(-1);
    if (checkAndNotZero(p)) return p;
    p.pop_front();
  } while (next_permutation(p.begin(), p.end()));
  return {};
}
bool isPowerOfTwo(long long n) {
  long long pot = 1;
  while (pot < n) pot *= 2;
  return pot == n;
}
deque<long long> generateNotZero(long long n) {
  if (n % 2 == 0) {
    if (!isPowerOfTwo(n)) {
      deque<long long> ans(n + 1, -1);
      for (int i = 2; i < n - 2; i += 2) {
        ans[i] = i + 1;
        ans[i + 1] = i;
      }
      ans[1] = n - 1;
      ans[n - 1] = 1;
      ans[n - 2] = n;
      ans[n] = n - 2;
      assert(checkAndNotZero(ans));
      return ans;
    } else {
      return {};
    }
  } else {
    if (n <= 5) {
      return {};
    } else {
      deque<long long> ans = getBruteNotZero(7);
      ans.resize(n + 1);
      for (int i = 8; i < n; i += 2) {
        ans[i] = i + 1;
        ans[i + 1] = i;
      }
      assert(checkAndNotZero(ans));
      return ans;
    }
  }
  return {};
}
long long binNegate(long long x, long long sz) { return ((1 << sz) - 1) & ~x; }
int getBit(long long mask, long long pos) { return (mask >> pos) & 1; }
deque<long long> generateZero(long long n) {
  if (n % 2 == 1) return {};
  if (isPowerOfTwo(n + 1)) return {};
  long long lastBit = 31 - __builtin_clz(n);
  set<long long> s;
  for (int i = n; i >= 1; i--) s.insert(i);
  deque<long long> ans(n + 1, -1);
  while (!s.empty()) {
    vector<long long> erased;
    for (long long x : s) {
      if (getBit(x, lastBit) == 1) {
        long long match = binNegate(x, lastBit + 1);
        assert(s.find(match) != s.end());
        ans[x] = match;
        ans[match] = x;
        erased.push_back(x);
        erased.push_back(match);
      }
    }
    for (long long x : erased) s.erase(x);
    lastBit--;
  }
  assert(checkAndZero(ans));
  return ans;
}
void printAnswer(deque<long long> ans) {
  if (ans.empty()) {
    cout << "NO\n";
  } else {
    long long n = ans.size() - 1;
    cout << "YES\n";
    for (int i = 1; i <= n; i++) {
      cout << ans[i] << " ";
    }
    cout << "\n";
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n;
  cin >> n;
  printAnswer(generateZero(n));
  printAnswer(generateNotZero(n));
  return 0;
}

```