#include <bits/stdc++.h>
using ul = std::uint32_t;
using li = std::int32_t;
using ll = std::int64_t;
using ull = std::uint64_t;
using vul = std::vector<ul>;
using vvul = std::vector<vul>;
using pulul = std::pair<ul, ul>;
using llf = long double;
std::mt19937_64 rnd;
ul n;
ull p, m;
ul a;
ull q;
ull phi;
ull power(ull a, ul b) {
  ull ret = 1;
  while (b) {
    if (b & 1) {
      ret *= a;
    }
    b >>= 1;
    a *= a;
  }
  return ret;
}
ull plus(ull a, ull b, ull base) { return a + b < base ? a + b : a + b - base; }
ull minus(ull a, ull b, ull base) { return a < b ? a + base - b : a - b; }
ull mul(ll a, ll b, ll base) {
  ll temp = a * b - ll(llf(a) * llf(b) / llf(base)) * ll(base);
  return temp < 0 ? temp + base : (temp >= base ? temp - base : temp);
}
ull pow(ull a, ull b, ull base) {
  ull ret = 1;
  while (b) {
    if (b & 1) {
      ret = mul(ret, a, base);
    }
    b >>= 1;
    a = mul(a, a, base);
  }
  return ret;
}
const ul tim = 12;
bool miller_rabin(ull x) {
  if (x == 1) {
    return false;
  }
  if (x == 0) {
    return false;
  }
  if (x == 2) {
    return true;
  }
  if (x % 2 == 0) {
    return false;
  }
  ull s;
  for (s = x - 1; ~s & 1; s >>= 1)
    ;
  for (ul i = 0; i != tim; ++i) {
    ull t = rnd() % x;
    if (t == 0) {
      continue;
    }
    if (pow(t, x - 1, x) != 1) {
      return false;
    }
    t = pow(t, s, x);
    if (t == 1) {
      continue;
    }
    while (true) {
      if (t == x - 1) {
        break;
      }
      t = mul(t, t, x);
      if (t == 1) {
        return false;
      }
    }
  }
  return true;
}
ull gcd(ull a, ull b) {
  while (a) {
    a ^= b ^= a ^= b %= a;
  }
  return b;
}
ull pollard_rho(ull x) {
  while (true) {
    ull a = rnd() % x, c = rnd() % x, b = plus(mul(a, a, x), c, x);
    while (a != b) {
      ull temp = gcd(minus(b, a, x), x);
      if (temp != 1) {
        return temp;
      }
      a = plus(mul(a, a, x), c, x);
      b = plus(mul(b, b, x), c, x);
      b = plus(mul(b, b, x), c, x);
    }
  }
}
void getfacts(ull x, std::deque<ull>& queue, std::vector<ull>& ans) {
  queue.resize(0);
  ans.resize(0);
  queue.push_back(x);
  while (queue.size()) {
    ull t = queue.front();
    queue.pop_front();
    if (miller_rabin(t)) {
      ans.push_back(t);
    } else {
      ull s = pollard_rho(t);
      queue.push_back(s);
      queue.push_back(t / s);
    }
  }
}
std::vector<ull> phifacts;
std::deque<ull> queue;
std::vector<ull> mfacts;
std::set<ull> ans;
ull degree(ull x) {
  ull test = phi;
  for (ull t : phifacts) {
    if (pow(x, test / t, m) == 1) {
      test /= t;
    }
  }
  return test;
}
void out() {
  for (auto it = ans.begin(); it != ans.end(); ++it) {
    if (it != ans.begin()) {
      std::printf(" ");
    }
    std::printf("%llu", *it);
  }
  std::printf("\n");
}
int main() {
  rnd.seed(std::time(0));
  std::scanf("%u%llu%llu", &n, &m, &p);
  if (m == 2) {
    std::printf("-1\n");
    return 0;
  }
  getfacts(m, queue, mfacts);
  q = mfacts[0];
  a = mfacts.size();
  if (p % q == 0) {
    if (power(q, a - 1) * (q - 1) - 1 < n) {
      std::printf("-1\n");
      return 0;
    } else {
      for (ull t = 2, cnt = 0; cnt != n; ++t) {
        if (t % q == 0) {
          continue;
        } else {
          if (cnt) {
            std::printf(" ");
          }
          std::printf("%llu", t);
          ++cnt;
        }
      }
      std::printf("\n");
      return 0;
    }
  } else {
    phi = power(q, a - 1) * (q - 1);
    getfacts(phi, queue, phifacts);
    ull degp = degree(p);
    if (degp == phi) {
      std::printf("-1\n");
      return 0;
    }
    if (q != 2 || a == 2) {
      for (ull i = 0; i != m; ++i) {
        if (i % q == 0) {
          continue;
        }
        ull degi = degree(i);
        ull curr = 1;
        if (degi == phi) {
          for (ull j = 0; j != phi; ++j, curr = mul(i, curr, m)) {
            if (j % (phi / degp) == 0) {
              continue;
            }
            ans.insert(curr);
            if (ans.size() == n) {
              out();
              return 0;
            }
          }
          std::printf("-1\n");
          return 0;
        }
      }
    } else {
      if (p % 4 == 1) {
        for (ull i = 1; i < m; i += 4) {
          ull t = mul(i, m / 2 - 1, m);
          ans.insert(t);
          if (ans.size() == n) {
            out();
            return 0;
          }
        }
        if (degp == phi / 2) {
          std::printf("-1\n");
          return 0;
        }
        for (ull i = 1; i < m; i += 4) {
          ull degi = degree(i);
          if (degi == phi / 2) {
            for (ull j = 0, curr = 1; j != phi / 2;
                 ++j, curr = mul(i, curr, m)) {
              if (j % (phi / 2 / degp) == 0) {
                continue;
              }
              ans.insert(curr);
              if (ans.size() == n) {
                out();
                return 0;
              }
            }
            std::printf("-1\n");
            return 0;
          }
        }
      } else if (p != m / 2 - 1 && p != m - 1) {
        for (ul i = 1; i < m; i += 4) {
          ull degi = degree(i);
          if (degi == phi / 2) {
            for (ull j = 0, curr = 1; j != phi / 2;
                 ++j, curr = mul(curr, i, m)) {
              if (j % (phi / 2 / degp) != 0) {
                ans.insert(curr);
                if (ans.size() == n) {
                  out();
                  return 0;
                }
                ans.insert(mul(curr, m / 2 - 1, m));
                if (ans.size() == n) {
                  out();
                  return 0;
                }
              } else {
                ans.insert(mul(pow(p, j / (phi / 2 / degp), m), m / 2 - 1, m));
                if (ans.size() == n) {
                  out();
                  return 0;
                }
              }
            }
            std::printf("-1\n");
            return 0;
          }
        }
      } else {
        for (ull i = 3; i < m; i += 2) {
          if (i == p) {
            continue;
          }
          ans.insert(i);
          if (ans.size() == n) {
            out();
            return 0;
          }
        }
        std::printf("-1\n");
        return 0;
      }
    }
  }
  return 0;
}
