#include <bits/stdc++.h>
using namespace std;
int n;
int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); }
int main() {
  scanf("%d", &n);
  if (n == 1) {
    printf("0\n0\n0\n");
    return 0;
  }
  for (int t = 1; t <= n - 1; t++)
    if (gcd(t, n) == 1 && gcd(t + 1, n) == 1) {
      for (int i = 0; i < n; i++) printf("%d ", i);
      printf("\n");
      for (int i = 0; i < n; i++) printf("%d ", (int)(1ll * t * i % n));
      printf("\n");
      for (int i = 0; i < n; i++) printf("%d ", (int)(1ll * (t + 1) * i % n));
      printf("\n");
      return 0;
    }
  printf("-1\n");
  return 0;
}
