#include #include #include #include #include #include #include #include #include namespace ranges = std::ranges; namespace views = std::views; // #include "Src/Number/IntegerDivision.hpp" // #include "Src/Utility/BinarySearch.hpp" // #include "Src/Sequence/CompressedSequence.hpp" // #include "Src/Sequence/RunLengthEncoding.hpp" // #include "Src/Algebra/Group/AdditiveGroup.hpp" // #include "Src/DataStructure/FenwickTree/FenwickTree.hpp" // #include "Src/DataStructure/SegmentTree/SegmentTree.hpp" // #include "Src/DataStructure/DisjointSetUnion/DisjointSetUnion.hpp" // using namespace zawa; // #include "atcoder/modint" // using mint = atcoder::modint998244353; using namespace std; int Q, K; int nand(int a, int b) { return (a == 1 and b == 1 ? 0 : 1); } int main() { cin.tie(0); cout.tie(0); ios::sync_with_stdio(0); cin >> Q >> K; vector> A(4); A[0] = {0, 0}; A[1] = {0, 1}; A[2] = {1, 0}; A[3] = {1, 1}; vector> ans; auto op = [&](int p, int q) { ans.push_back({p + 1, q + 1}); for (int k = 0 ; k < 4 ; k++) { A[k].push_back(nand(A[k][p], A[k][q])); } }; op(0, 1); op(1, 2); for (int i = 0 ; i < 200000 ; i++) { if (i & 1) op(2, 4); else op(0, 3); } for (int i = 0 ; i < Q ; i++) { const int p = i % 3, q = i + 1; ans.push_back({p, q}); } int sum = 0; for (const vector& a : A) { // for (int x : a | views::take(Q)) cout << x << ' '; // cout << endl; sum = max(sum, accumulate(a.begin(), a.begin() + Q, 0)); } if (sum <= K) { cout << "Yes\n"; for (auto [i, j] : ans | views::take(Q)) cout << i << ' ' << j << '\n'; } else { cout << "No\n"; } }