#include <bits/stdc++.h>
using namespace std;
void Fast() {
  std::ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  cerr.tie(NULL);
}
inline int D() {
  int t;
  scanf("%d", &t);
  return t;
}
inline long long llD() {
  long long t;
  scanf("%lld", &t);
  return t;
}
long long MOD = 1e9 + 7;
const int N = 1e5 + 5, M = 1e4 + 5;
int OO = 1e9;
long long n, m, k, cnt, SU, idx, len, MN, MX, T, ans = 1e6;
long long l, r, mid;
long long a, b, c, d;
vector<pair<int, int>> vec;
bool valid() {
  bool flage = true;
  for (int i = 0; i < n; ++i) vec.push_back({(i + i) % n, i});
  sort(vec.begin(), vec.end());
  for (int i = 0; i < n; ++i) flage &= (i == vec[i].first);
  return flage;
}
int main() {
  cin >> n;
  if (!valid()) return cout << "-1", 0;
  for (int i = 0; i < n; ++i) cout << vec[i].second << " ";
  cout << "\n";
  for (int i = 0; i < n; ++i) cout << vec[i].second << " ";
  cout << "\n";
  for (int i = 0; i < n; ++i) cout << i << " ";
  cout << "\n";
}
