#include <bits/stdc++.h>
using namespace std;
const int INF = INT_MAX;
const long long INFL = LLONG_MAX;
const long double pi = acos(-1);
int isprime(int a) {
  if (a == 1) return 0;
  for (int d = 2; d * d <= a; d++)
    if (a % d == 0) return 0;
  return 1;
}
int main() {
  ios_base::sync_with_stdio(0);
  cout.precision(15);
  cout << fixed;
  cout.tie(0);
  cin.tie(0);
  int N;
  cin >> N;
  vector<int> A;
  if (N <= 10) {
    for (int(i) = 0, j123 = N; (i) < j123; (i)++) {
      A.push_back(i);
    }
    do {
      set<int> s;
      for (int(i) = 0, j123 = N; (i) < j123; (i)++) s.insert((i + A[i]) % N);
      if (int(s.size()) == N) {
        for (int(i) = 0, j123 = N; (i) < j123; (i)++)
          cout << A[i] << (i + 1 == N ? '\n' : ' ');
        for (int(i) = 0, j123 = N; (i) < j123; (i)++)
          cout << i << (i + 1 == N ? '\n' : ' ');
        for (int(i) = 0, j123 = N; (i) < j123; (i)++)
          cout << (i + A[i]) % N << (i + 1 == N ? '\n' : ' ');
        return 0;
      }
    } while (next_permutation(A.begin(), A.end()));
  } else {
    if (N & 1) {
      for (int(i) = 0, j123 = N; (i) < j123; (i)++)
        cout << i << (i + 1 == N ? '\n' : ' ');
      for (int(i) = 0, j123 = N; (i) < j123; (i)++)
        cout << i << (i + 1 == N ? '\n' : ' ');
      for (int(i) = 0, j123 = N; (i) < j123; (i)++)
        cout << (i + i) % N << (i + 1 == N ? '\n' : ' ');
      return 0;
    }
  }
  cout << -1 << '\n';
}
