#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
const long long MRP[] = {2LL,      325LL,     9375LL,      28178LL,
                         450775LL, 9780504LL, 1795265022LL};
void inc(long long &a, long long b, long long mod) {
  if ((a += b) >= mod) a -= mod;
}
long long mlt(long long a, long long b, long long mod) {
  long long ret = 0;
  while (true) {
    if (b & 1) inc(ret, a, mod);
    if ((b >>= 1) == 0) return ret;
    inc(a, a, mod);
  }
}
long long pw(long long x, long long n, long long mod) {
  long long ret = 1 % mod;
  x %= mod;
  while (true) {
    if (n & 1) ret = mlt(ret, x, mod);
    if ((n >>= 1) == 0) return ret;
    x = mlt(x, x, mod);
  }
}
bool millerrabin_isprime(long long n, long long a) {
  long long d = n - 1;
  int r = 0;
  while (d % 2 == 0) d /= 2, ++r;
  a %= n;
  if (a == 0) return true;
  long long x = pw(a, d, n);
  if (x == 1 || x == n - 1) return true;
  for (int i = (0); i < (r - 1); ++i) {
    x = mlt(x, x, n);
    if (x == 1) return false;
    if (x == n - 1) return true;
  }
  return false;
}
bool millerrabin_isprime(long long n) {
  if (n % 2 == 0) return n == 2;
  if (n <= 3) return n == 3;
  for (int i = (0); i < (7); ++i)
    if (!millerrabin_isprime(n, MRP[i])) return false;
  return true;
}
long long pollardrho(long long val) {
  if (val == 1)
    return 1;
  else if (val % 2 == 0)
    return 2;
  static mt19937_64 rnd(1237891);
  while (true) {
    long long x = rnd() % (val - 3) + 2, y = x, c = rnd() % val, d = 1;
    while (d == 1) {
      x = mlt(x, x, val);
      inc(x, c, val);
      y = mlt(y, y, val);
      inc(y, c, val);
      y = mlt(y, y, val);
      inc(y, c, val);
      d = gcd(abs(x - y), val);
    }
    if (d != val) return d;
  }
}
vector<pair<long long, int>> factorize(long long val) {
  vector<long long> factors;
  queue<long long> q;
  if (val != 1) q.push(val);
  while (!q.empty()) {
    long long cur = q.front();
    q.pop();
    if (millerrabin_isprime(cur)) {
      factors.push_back(cur);
      continue;
    }
    long long d = pollardrho(cur);
    q.push(d);
    q.push(cur / d);
  }
  sort(factors.begin(), factors.end());
  vector<pair<long long, int>> ret;
  for (int l = 0, r = l; l < ((int)(factors).size()); l = r) {
    while (r < ((int)(factors).size()) && factors[r] == factors[l]) ++r;
    ret.push_back(make_pair(factors[l], r - l));
  }
  return ret;
}
const int MAXNEED = 500000;
int need;
long long mod, forbidden;
long long ans[MAXNEED];
int nans;
long long p;
int k;
long long phi;
vector<pair<long long, int>> phifactors;
long long forbiddenorder;
long long gen, genord;
long long safemlt(long long a, long long b) {
  assert(a >= 1 && b >= 1);
  return a > LLONG_MAX / b ? LLONG_MAX : a * b;
}
long long safepw(long long x, int n) {
  long long ret = 1;
  while (true) {
    if (n & 1) ret = safemlt(ret, x);
    if ((n >>= 1) == 0) return ret;
    x = safemlt(x, x);
  }
}
void calcpk() {
  p = mod;
  k = 1;
  for (int i = 2;; ++i) {
    if (safepw(2, i) > mod) break;
    long long l = 2, r = 4;
    while (safepw(r, i) <= mod) l = r, r += r;
    while (l + 1 < r) {
      long long m = l + (r - l) / 2;
      if (safepw(m, i) <= mod)
        l = m;
      else
        r = m;
    }
    if (safepw(l, i) == mod) p = l, k = i;
  }
}
void calcforbiddenorder() {
  phi = p - 1;
  for (int i = (0); i < (k - 1); ++i) phi *= p;
  phifactors = factorize(phi);
  if (gcd(mod, forbidden) == 1) {
    forbiddenorder = phi;
    for (int i = (0); i < (((int)(phifactors).size())); ++i) {
      long long pp = phifactors[i].first;
      for (int j = (0); j < (phifactors[i].second); ++j) forbiddenorder /= pp;
      long long cur = pw(forbidden, forbiddenorder, mod);
      while (cur != 1) cur = pw(cur, pp, mod), forbiddenorder *= pp;
    }
  } else {
    forbiddenorder = -1;
  }
}
void calcgen() {
  if (p == 2) {
    genord = phi / 2;
    if (k == 1)
      gen = 1;
    else if (k == 2)
      gen = 3;
    else
      gen = 5;
  } else {
    genord = phi;
    for (gen = 2;; ++gen) {
      assert(gen < mod);
      bool ok = true;
      for (int i = (0); i < (((int)(phifactors).size())); ++i)
        if (pw(gen, phi / phifactors[i].first, mod) == 1) {
          ok = false;
          break;
        }
      if (ok) break;
    }
  }
}
bool solve() {
  calcpk();
  calcforbiddenorder();
  long long have = phi - (forbiddenorder == -1 ? 1 : forbiddenorder);
  if (have < need) return false;
  nans = 0;
  if (forbiddenorder == -1) {
    for (long long i = 2; nans < need && i < mod; ++i)
      if (i % p != 0) ans[nans++] = i;
  } else {
    calcgen();
    if (genord != phi && forbidden % 4 == 3) {
      for (long long aval = 1, bval = forbidden, exp = 0;
           exp < genord && nans < need;
           aval = mlt(aval, gen, mod), bval = mlt(bval, gen, mod), ++exp) {
        if (nans < need && exp % (2 * genord / forbiddenorder) != 0)
          ans[nans++] = aval;
        if (nans < need && exp % (2 * genord / forbiddenorder) != 0)
          ans[nans++] = bval;
      }
    } else {
      for (long long val = 1, exp = 0; exp < genord && nans < need;
           val = mlt(val, gen, mod), ++exp) {
        if (nans < need && exp % (genord / forbiddenorder) != 0)
          ans[nans++] = val;
        if (nans < need && genord != phi) ans[nans++] = mod - val;
      }
    }
  }
  assert(nans == need);
  return true;
}
void run() {
  scanf("%d%lld%lld", &need, &mod, &forbidden);
  if (!solve()) {
    printf("-1\n");
    return;
  }
  for (int i = (0); i < (need); ++i) {
    if (i != 0) printf(" ");
    printf("%lld", ans[i]);
  }
  puts("");
}
int main() {
  run();
  return 0;
}
