#include #include const std::string Possible{"Possible"}; const std::string Impossible{"Impossible"}; /** * i(kp-1) * : i(kp+1) * : : * +-------+ ......i * | ..... | * | : : | * | : : | * | : : | * | : : | * | : : +---- ......-R+i * ---------+ : :....... * ...........: */ int main() { std::ios::sync_with_stdio(false); std::cin.tie(nullptr); int p, q; std::cin >> p >> q; if (p == 1) { std::cout << Impossible << '\n'; return 0; } std::cout << Possible << '\n'; const int R = q / p; // 拡大率 k (=D/q) が満たすべき条件: R(kp+1)-R(kp-1) < kp // k=ceil((2R+1)/p) で十分 const int k = 2 * R / p + 1; std::vector> points; for (int i = 0; i < R; ++i) { int x = i * (k * p + 1); int y = i; // R while (y > -R + i) { points.emplace_back(x, y); --y; } while (x < (i + 1) * (k * p - 1)) { points.emplace_back(x, y); ++x; } // R + 1 while (y < i + 1) { points.emplace_back(x, y); ++y; } while (x < (i + 1) * (k * p + 1)) { points.emplace_back(x, y); ++x; } } int x = R * (k * p + 1); int y = R; // R while (y > 0) { points.emplace_back(x, y); --y; } while (x <= k * q) { points.emplace_back(x, y); ++x; } // x 方向の長さの和 = kq <= 125000 where R<=249,2<=p