#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
int a[N], b[N], c[N];
int n;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  if (n % 2 == 0) {
    cout << -1 << endl;
    return 0;
  }
  for (int i = 0; i < n; i++) a[i] = i;
  if (n % 2 == 1) {
    for (int i = n - 1, j = 0; i >= 0; i--) {
      b[i] = j;
      j += 2;
      if (j >= n) {
        j = 1;
      }
    }
  }
  for (int i = 0; i < n; i++) c[i] = (a[i] + b[i]) % n;
  for (int i = 0; i < n; i++) cout << a[i] << " ";
  cout << endl;
  for (int i = 0; i < n; i++) cout << b[i] << " ";
  cout << endl;
  for (int i = 0; i < n; i++) cout << c[i] << " ";
  cout << endl;
  return 0;
}
