#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int A[n];
  memset(A, 0, sizeof(A));
  for (int i = 0, j = 1; i < n; j++, i++) {
    A[(i + j % n) % n] += 1;
  }
  for (int i = 0; i < n; i++) {
    if (A[i] != 1) {
      cout << -1 << endl;
      return 0;
    }
  }
  for (int i = 0; i < n; i++) cout << i << " ";
  cout << endl;
  for (int i = 1; i <= n; i++) cout << i % n << " ";
  cout << endl;
  for (int i = 0, j = 1; i < n; j++, i++) {
    cout << (i + j % n) % n << " ";
  }
  cout << endl;
}
