#include using namespace std; void print(int i, int j){ printf("%d %d", i, j); cout << endl; } int main () { int x,y; cin >> x >> y; printf("%d %d\n", x * y, x * y); for(int i = 1; i <= x * y; i++){ if(i <= x - 1){ print(i, i + 1); print(i, i + x); } else if (i == x){ print(i, 1); print(i, i + x); } else if (i <= x * (y - 1)){ print(i, i + x); } } //cout << endl; }