#include <bits/stdc++.h>
using namespace std;
inline char nc() {
  return getchar();
  static char buf[100000], *l = buf, *r = buf;
  return l == r && (r = (l = buf) + fread(buf, 1, 100000, stdin), l == r)
             ? EOF
             : *l++;
}
template <class T>
void read(T &x) {
  x = 0;
  int f = 1, ch = nc();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = nc();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 - '0' + ch;
    ch = nc();
  }
  x *= f;
}
template <class T>
inline T ABS(T x) {
  return x < 0 ? -x : x;
}
int n;
long long m, p;
vector<long long> an;
vector<long long> prime;
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
inline long long add(long long x, long long mod) {
  return x >= mod ? x - mod : x;
}
inline long long mul(long long x, long long y, long long mod) {
  static const long long M0 = 1e9, M1 = 1e12;
  if (mod <= M0) return x * y % mod;
  if (mod <= M1)
    return (((x * (y >> 20) % mod) << 20) + x * (y & ((1 << 20) - 1))) % mod;
  long long re = x * y - (long long)((long double)x * y / mod + 0.5) * mod;
  return re < 0 ? re + mod : re;
}
long long power(long long x, long long y, long long mod) {
  long long re = 1;
  while (y) {
    if (y & 1) re = mul(re, x, mod);
    x = mul(x, x, mod);
    y >>= 1;
  }
  return re;
}
namespace miller_rabin {
const int a[] = {2, 3, 7, 11, 19, 31};
long long q;
int k;
bool witness(long long a, long long p) {
  a = power(a, q, p);
  if (a == 1 || a == p - 1) return 0;
  for (int i = 1; i < k; ++i) {
    a = mul(a, a, p);
    if (a == p - 1) return 0;
  }
  return 1;
}
bool check(long long p) {
  if (p == 1) return 0;
  if (p == 2) return 1;
  if (~p & 1) return 0;
  q = p - 1, k = 0;
  while (~q & 1) q >>= 1, ++k;
  for (int i = 0; i < 6; ++i)
    if (a[i] < p) {
      if (witness(a[i], p)) return 0;
    }
  return 1;
}
}  // namespace miller_rabin
namespace pollard_rho {
long long find(long long n, long long c) {
  long long x = rand() % n, y = x;
  while (true) {
    x = add(mul(x, x, n) + c, n);
    y = add(mul(y, y, n) + c, n);
    y = add(mul(y, y, n) + c, n);
    long long d = gcd(ABS(x - y), n);
    if (d == n) return 1;
    if (d != 1) return d;
  }
}
void find(long long n) {
  if (miller_rabin::check(n)) {
    prime.push_back(n);
    return;
  }
  while (true) {
    long long d = find(n, rand() % n);
    if (d != 1) {
      find(d), find(n / d);
      return;
    }
  }
}
void sol(long long n) {
  prime.clear();
  while (~n & 1) prime.push_back(2), n >>= 1;
  if (n == 1) return;
  find(n);
}
}  // namespace pollard_rho
int main() {
  srand((unsigned long long)(new char));
  read(n), read(m), read(p);
  pollard_rho::sol(m);
  long long q = prime[0], phi = m - m / q;
  int k = prime.size();
  if (gcd(m, p) != 1) {
    if (phi - 1 < n) {
      puts("-1");
      return 0;
    }
    for (int i = 2;; ++i)
      if (i % q) {
        an.push_back(i);
        if (--n == 0) break;
      }
  } else {
    pollard_rho::sol(phi);
    long long ord = phi;
    for (int i = 0; i < prime.size(); ++i) {
      if (power(p, ord / prime[i], m) == 1) ord /= prime[i];
    }
    if (phi - ord < n) {
      puts("-1");
      return 0;
    }
    sort(prime.begin(), prime.end());
    prime.reserve(unique(prime.begin(), prime.end()) - prime.begin());
    long long g;
    if (q == 2 && k >= 3) {
      for (g = 1;; g += 4) {
        if (power(g, phi / 2, m) != 1) continue;
        bool ok = 1;
        for (int i = 0; i < prime.size(); ++i) {
          if (power(g, phi / 2 / prime[i], m) == 1) {
            ok = 0;
            break;
          }
        }
        if (ok) break;
      }
    } else {
      for (g = 1;; ++g) {
        if (power(g, phi, m) != 1) continue;
        bool ok = 1;
        for (int i = 0; i < prime.size(); ++i) {
          if (power(g, phi / prime[i], m) == 1) {
            ok = 0;
            break;
          }
        }
        if (ok) break;
      }
    }
    if (q == 2 && k >= 3 && (p & 3) == 3) {
      long long u = 1, v = p, s = phi / ord;
      for (int e = 0;; ++e, u = mul(u, g, m), v = mul(v, g, m))
        if (e % s) {
          an.push_back(u);
          if (--n == 0) break;
          an.push_back(v);
          if (--n == 0) break;
        }
    } else {
      long long u = 1, s = q == 2 ? phi / 2 / ord : phi / ord;
      for (int e = 0;; ++e, u = mul(u, g, m)) {
        if (e % s) {
          an.push_back(u);
          if (--n == 0) break;
        }
        if (q == 2) {
          an.push_back(m - u);
          if (--n == 0) break;
        }
      }
    }
  }
  for (int i = 0; i < an.size(); ++i) {
    if (i) printf(" ");
    printf("%lld", an[i]);
  }
  printf("\n");
  return 0;
}
