// iee
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdio>
#include <vector>
#include <set>
#include <map>
#define rep(i, a, b) for (auto i = (a); i <= (b); ++i)
#define per(i, a, b) for (auto i = (a); i >= (b); --i)
#define fi first
#define se second
using ll = long long;
using ull = unsigned long long;
using namespace std;
void work(int);
template <class T> void read(T &x) {
x = 0; int f = 1, ch = getchar();
while (!isdigit(ch)) { if (ch == '-') f = -1; ch = getchar(); }
while (isdigit(ch)) x = x * 10 + (ch - '0'), ch = getchar();
x *= f;
}
int main() {
int TT = 1; // cin >> TT;
rep(CAS, 1, TT)
work(CAS);
return 0;
}
void work(int CASE) {
int n, m;
cin >> n >> m;
vector<pair<int, int>> ans;
int ns = m;
for (int i = n - 1; i >= 0; ) {
int k = ns;
while (i != (k & i)) ++k;
//cerr << i << ' ' << ns << ' ' << k << '\n';
per(j, k, ns) ans.emplace_back(i, j), --i;
ns = k + 1;
}
reverse(begin(ans), end(ans));
for (auto it: ans)
cout << it.fi << ' ' << it.se << '\n';
}