欢迎来到起遇信息学
起遇信息学正处于上线筹建阶段,以下功能已全部开放免费体验: ✅ 完整题库浏览与代码提交评测(C / C++ / Python / Java 等) ✅ 入门到进阶的系列课程试读、作业与考试 ✅ AI 提示、AI 作业分析等智能助教功能 ✅ 赛事模拟与个人能力报告 ✅ 邮箱注册开放 ⏳ 付费课程订阅与微信/支付宝支付通道 ⏳ 手机号登录,微信扫码登录、微信公众号绑定 使用中如遇任何问题,欢迎通过页面底部 **"联系我们"** 与我们沟通。
CF1395B.Boboniu Plays Chess
Boboniu Plays Chess
Boboniu likes playing chess with his employees. As we know, no employee can beat the boss in the chess game, so Boboniu has never lost in any round.
You are a new applicant for his company. Boboniu will test you with the following chess question:
Consider a grid (rows are numbered from to , and columns are numbered from to ). You have a chess piece, and it stands at some cell which is not on the border (i.e. and ).
From the cell , you can move your chess piece to () or (). In other words, the chess piece moves as a rook. From the cell, you can move to any cell on the same row or column.
Your goal is to visit each cell exactly once. Can you find a solution?
Note that cells on the path between two adjacent cells in your route are not counted as visited, and it is not required to return to the starting point.
Input
The only line of the input contains four integers , , and (, , ) — the number of rows, the number of columns, and the initial position of your chess piece, respectively.
Output
You should print lines.
The -th line should contain two integers and (, ), denoting the -th cell that you visited. You should print exactly pairs , they should cover all possible pairs , such that , .
We can show that under these constraints there always exists a solution. If there are multiple answers, print any.
Note
Possible routes for two examples:

Samples
3 3 2 2
2 2
1 2
1 3
2 3
3 3
3 2
3 1
2 1
1 1
3 4 2 2
2 2
2 1
2 3
2 4
1 4
3 4
3 3
3 2
3 1
1 1
1 2
1 3
在线编程 IDE
建议全屏模式获得最佳体验
| 进入全屏编程 | Alt+E |
| 递交评测 | Ctrl+Enter |
| 注释/取消注释 | Ctrl+/ |
| 缩放字体 | Ctrl+滚轮 |