#include <bits/stdc++.h>
using namespace std;
int main() {
  long long a[100005], b[100006] = {}, n, i, x = 0, y;
  cin >> n;
  if (n % 2 == 0)
    cout << "-1" << endl;
  else if (n == 1)
    cout << "0\n0\n0";
  else {
    x = 0;
    for (i = (n + 1) / 2; i >= 0; i = i - 2) {
      a[x++] = i;
      b[i] = 1;
    }
    if ((n + 1) / 2 % 2 == 0)
      y = n - 2;
    else
      y = n - 1;
    for (i = y; i >= 0; i = i - 2) {
      a[x++] = i;
      b[i] = 1;
    }
    for (i = n - 1; i >= 0; i--)
      if (b[i] != 1) a[x++] = i;
    for (i = 0; i < n; i++) cout << i << " ";
    cout << endl;
    for (i = 0; i < n; i++) cout << a[i] << " ";
    cout << endl;
    for (i = 0; i < n; i++) cout << (a[i] + i) % n << " ";
  }
  return 0;
}
