#line 2 "/Users/baluteshih/coding/cplibrary/default_code.hpp" #line 2 "/Users/baluteshih/coding/cplibrary/assumption.hpp" #include #include #line 4 "/Users/baluteshih/coding/cplibrary/default_code.hpp" using namespace std; typedef long long ll; typedef pair pii; typedef pair pll; #define X first #define Y second #define SZ(a) ((int)a.size()) #define ALL(v) v.begin(), v.end() template concept PrintableContainer = requires(T& a) { a.begin(); a.end(); } && !std::convertible_to, std::string_view>; template ostream& operator<<(ostream& os, const pair &a); template std::ostream& operator<<(std::ostream& os, const T& a); template ostream& operator<<(ostream& os, const pair &a) { os << "(" << a.first << ", " << a.second << ")"; return os; } template std::ostream& operator<<(std::ostream& os, const T& a) { os << "[ "; bool first = true; for (const auto& item : a) { if (!first) os << ", "; os << item; first = false; } return os << " ]"; } #ifdef bbq #include #define safe cerr<<__PRETTY_FUNCTION__<<" line "<<__LINE__<<" safe\n" #define sepline sepline_() #define debug(a...) debug_(#a, a) #define orange(a...) orange_(#a, a) void debug_(auto s, auto ...a) { cerr << "\e[1;32m(" << s << ") = ("; int f = 0; (..., (cerr << (f++ ? ", " : "") << a)); cerr << ")\e[0m\n"; } void orange_(auto s, auto L, auto R) { cerr << "\e[1;33m[ " << s << " ] = [ "; using namespace experimental; copy(L, R, make_ostream_joiner(cerr, ", ")); cerr << " ]\e[0m\n"; } void sepline_(int length = 50) { cerr << "\e[1;35m"; cerr << string(length, '='); cerr << "\e[0m\n"; } #else #define safe ((void)0) #define sepline safe #define debug(...) safe #define orange(...) safe #endif void chmax(auto &x, auto val) { x = max(x, val); } void chmin(auto &x, auto val) { x = min(x, val); } auto floor_div(auto a, auto b) { return a / b - (a % b && (a < 0) ^ (b < 0)); } auto ceil_div(auto a, auto b) { return a / b + (a % b && (a < 0) ^ (b > 0)); } string bitstring(auto x, int width = -1) { string res; while (x) res.push_back((x & 1) + '0'), x >>= 1; if (res.empty()) res = "0"; if (width != -1) res.resize(width, '0'); ranges::reverse(res); return res; } vector count_array(const auto &container, int sz = -1) { if (sz == -1) sz = *ranges::max_element(container) + 1; vector res(sz); for (auto x : container) ++res[x]; return res; } #line 2 "B.cpp" int main() { ios::sync_with_stdio(0), cin.tie(0); int n, m, k; cin >> n >> m >> k; set edges; for (int i = 0; i < n; ++i) for (int j = i + 1; j < n; ++j) edges.emplace(i, j); vector ans; if (k > 1) { for (int i = 0; i + 1 < k; ++i) edges.erase(pii(i, i + 1)); edges.erase(pii(k - 1, n - 1)); ans.emplace_back(0, n - 1); edges.erase(pii(0, n - 1)); for (int i = 0; i + 2 < k; ++i) { for (int j = i + 2; j + 1 < n; ++j) { ans.emplace_back(i, j); edges.erase(pii(i, j)); } ans.emplace_back(i + 1, n - 1); edges.erase(pii(i + 1, n - 1)); } } else { edges.erase(pii(0, n - 1)); } if (SZ(ans) > m || SZ(edges) + SZ(ans) < m) cout << "No\n"; else { cout << "Yes\n"; for (auto [u, v] : ans) cout << u + 1 << " " << v + 1 << "\n"; for (int i = SZ(ans); auto [u, v] : edges) if (i++ >= m) break; else cout << u + 1 << " " << v + 1 << "\n"; } }