#include <bits/stdc++.h>
using namespace std;
#pragma comment(linker, "/STACK:32777216");
int a[1 << 17], b[1 << 17], c[1 << 17];
bool used[1 << 17];
int main() {
  int n;
  scanf("%d", &n);
  if (n % 2 == 0) {
    cout << -1 << endl;
    return 0;
  }
  for (int i = 0; i < n; i++) b[i] = i;
  for (int i = 0; i < n; i++) {
    for (int j = i; j < n; j++) {
      int res = (i + j) % n;
      if (!used[res]) {
        used[res] = true, a[i] = i, swap(b[i], b[j]), c[i] = res;
        break;
      }
    }
  }
  for (int i = 0; i < n; i++) {
    printf("%d ", a[i]);
  }
  cout << endl;
  for (int i = 0; i < n; i++) {
    printf("%d ", b[i]);
  }
  cout << endl;
  for (int i = 0; i < n; i++) {
    printf("%d ", c[i]);
  }
  cout << endl;
  return 0;
}
