#include #include using namespace std; using namespace atcoder; #define all(x) (x).begin(), (x).end() #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define rrep(i, n) for(int i = (int)(n - 1); i >= 0; i--) template bool chmax(T &a,const T &b){if(a bool chmin(T &a,const T &b){if(a>b){a=b;return true;}return false;} using ll = long long; #define int ll using vi = vector; using vvi = vector>; using vb = vector; using vvb = vector>; using vs = vector; using pii = pair; /* using mint = modint; using vm = vector; using vvm = vector>; */ signed main(){ int x, y; cin >> x >> y; cout << x * y << ' ' << x * y << '\n'; rep(i, x){ cout << i + 1 << ' ' << (i + 1) % x + 1 << '\n'; } int pre; rep(i, x * (y - 1)){ if(i % (y - 1) == 0) pre = i / (y - 1); cout << pre + 1 << ' ' << i + x + 1 << '\n'; pre = i + x; } }