#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) {
  if (a == 0) return b;
  return gcd(b % a, a);
}
void printVec(const vector<int> &a) {
  for (int i = 0; i < a.size(); i++) {
    cout << a[i] << ' ';
  }
  cout << '\n';
}
int main() {
  int n;
  cin >> n;
  vector<int> a;
  set<int> setA;
  vector<int> b;
  set<int> setB;
  vector<int> c;
  int temp = n;
  for (int i = 0; i < n; i++) {
    c.push_back(i);
    b.push_back(--temp);
    a.push_back((c.back() - b.back() + n) % n);
    if (setA.count(a.back()) || setB.count(b.back())) {
      cout << -1 << endl;
      return 0;
    }
    setA.insert(a.back());
    setB.insert(b.back());
  }
  printVec(a);
  printVec(b);
  printVec(c);
  return 0;
}
