#include <bits/stdc++.h>
using namespace std;
const int limite = 1000000;
int v[limite];
int sol[limite];
int visto[limite];
int n;
void escribe() {
  cout << "YES" << endl;
  for (int i = 1; i <= n; i++) {
    if (i > 1) cout << " ";
    cout << sol[i];
  }
  cout << endl;
}
void sol1() {
  int c = 1;
  while (2 * c <= n) c *= 2;
  for (int i = n; i >= 1; i--) {
    if (not visto[i]) {
      int op = 2 * c - 1 - i;
      if (op == 0) {
        cout << "NO" << endl;
        return;
      }
      sol[i] = op;
      sol[op] = i;
      visto[i] = 1;
      visto[op] = 1;
    }
    if (c == i) c /= 2;
  }
  escribe();
}
void sol2() {
  if (n <= 5) {
    cout << "NO" << endl;
    return;
  }
  int c = 1;
  while (2 * c <= n) c *= 2;
  if (c == n) {
    cout << "NO" << endl;
    return;
  }
  int nv = 0;
  v[nv++] = 1;
  for (int p = 4; p <= c; p *= 2) {
    if (p == 4) {
      v[nv++] = 3;
      v[nv++] = 2;
    } else if (p == 8) {
      v[nv++] = 6;
      v[nv++] = 4;
      v[nv++] = 5;
      v[nv++] = 7;
    } else {
      int i = p / 2;
      v[nv++] = i + 1;
      v[nv++] = i;
      i += 2;
      for (; i < p; i++) v[nv++] = i;
    }
  }
  if (n == 6) {
    v[nv++] = 6;
    v[nv++] = 4;
    v[nv++] = 5;
    for (int i = 0; i < nv; i++) sol[v[i]] = v[(i + 1) % nv];
  } else if (n == 7) {
    v[nv++] = 6;
    v[nv++] = 4;
    v[nv++] = 5;
    v[nv++] = 7;
    for (int i = 0; i < nv; i++) sol[v[i]] = v[(i + 1) % nv];
  } else {
    for (int i = 0; i < nv; i++) sol[v[i]] = v[(i + 1) % nv];
    for (int i = c; i <= n; i++)
      if (i < n)
        sol[i] = i + 1;
      else
        sol[i] = c;
  }
  escribe();
}
int main() {
  ios::sync_with_stdio(false);
  cin >> n;
  sol1();
  sol2();
}
