// Subtasks:
// 2: AC
// 3: AC
// 5: AC
// _: WA

#include <algorithm>
#include <iostream>
#include <vector>

using namespace std;

int main() {
    int n, k;
    cin >> n >> k;

    vector<pair<int,vector<pair<int,int>>>> gadgets;
    vector<pair<int,int>> line;
    line.push_back({0, 0});
    int count = 0;
    for (int i = 1; i <= 100; i++) {
        count += i;
        line.push_back({0, i});
        gadgets.push_back({count, line});
    }
    gadgets.push_back({2, {{0, 0}, {0, 1}, {1, 1}}});
    gadgets.push_back({4, {{0, 0}, {0, 1}, {1, 1}, {1, 0}}});
    sort(gadgets.rbegin(), gadgets.rend());

    int pos = 0;
    int add = 1e6;
    for (int i = 0; i < gadgets.size(); i++) {
        if (gadgets[i].first <= k) {
            k -= gadgets[i].first;
            for (auto point : gadgets[i].second) {
                cout << point.first + pos << " " << point.second + pos << "\n";
                n--;
            }
            add++;
            pos += add;
        }
    }
    while (n > 0) {
        cout << pos << " " << pos << "\n";
        add++;
        pos += add;
        n--;
    }
}
