#include <bits/stdc++.h>
using namespace std;
const long long N = (long long)(1e3) + 5, mod = (long long)(1e9) + 7;
int main() {
  ios::sync_with_stdio(0);
  ios_base::sync_with_stdio(0);
  cin.tie(0), cout.tie(0);
  int n;
  cin >> n;
  vector<int> a(n), b(n), c(n);
  for (int i = 0; i < n; i++) a[i] = i;
  for (int i = 0; i + 1 < n; i++) b[i + 1] = i;
  b[0] = n - 1;
  for (int i = 0; i < n; i++) c[i] = (a[i] + b[i]) % n;
  if (n % 2 == 0)
    cout << -1 << endl;
  else {
    set<int> st;
    for (auto &i : c)
      if (i >= 0 && i < n) st.insert(i);
    if (st.size() != n) return cout << -1 << endl, 0;
    for (auto &i : a) cout << i << ' ';
    cout << endl;
    for (auto &i : b) cout << i << ' ';
    cout << endl;
    for (auto &i : c) cout << i << ' ';
    cout << endl;
  }
  return 0;
}
