#include using namespace std; int main() { int x = 0,y = 0; cin >> x >> y; cout << x * y << " " << x * y << endl; for (int i = 1;i < x;i++) { cout << i << " " << i + 1 << endl; } cout << x << " 1" << endl; for (int i = x + 1;i <= x * y;i++) { cout << i - x << " " << i << endl; } }