//06-09例题 T143408 同行列对角线的格子https://www.luogu.com.cn/problem/T143408
#include
using namespace std;
int main() {
int n = 0, i = 0, j = 0;
cin >> n >> i >> j;
int dis = 0;
//同行
for (int j = 1; j <= n; ++j)
{
cout << "(" << i << "," << j << ") ";
}
cout << endl;
//同列
for (int i = 1; i <= n; ++i)
{
cout << "(" << i << "," << j << ") ";
}
cout << endl;
//左上角到右下角
dis= min(i - 1,j - 1);//(i到1或j到1)的差值取较小值
//cout << dis <<endl;
for(int r=i - dis,c=j - dis;r<=n&&c<=n;++r,++c)//i-dis,j-dis,到左上角的位置,依次+1
{//左上角 i-dis j-dis,目标的行在(i,j)上方行i-dis,目标的列在左侧要列j-dis
printf("(%d,%d) ",r,c);
}
cout << endl;
//左下角到右上角
dis= min(n - i,j-1);//(i到n或j到1)的差值取较小值
//cout << dis <=1&&c<=n;--r,++c)//i+dis,j-dis,到左xia角的位置,依次行依次-1,列依次+1
{// 左下角i+dis j-dis,目标的行在(i,j)下方行i+dis,目标的列在左侧要列j-dis
printf("(%d,%d) ",r,c);
}
return 0;
}