题库练习 Immobile Knight
← 上一题 下一题 →

A15413 | Immobile Knight

时间限制1s
内存限制256MB
通过 / 提交0/0

题目描述

There is a chess board of size $n \times m$ . The rows are numbered from $1$ to $n$ , the columns are numbered from $1$ to $m$ .

Let's call a cell isolated if a knight placed in that cell can't move to any other cell on the board. Recall that a chess knight moves two cells in one direction and one cell in a perpendicular direction:

![](/uploads/acgo/image/45c7561690e03644_ce71f8ff0794.jpeg)Find any isolated cell on the board. If there are no such cells, print any cell on the board.

输入格式

The first line contains a single integer $t$ ( $1 \le t \le 64$ ) — the number of testcases.

The only line of each testcase contains two integers $n$ and $m$ ( $1 \le n, m \le 8$ ) — the number of rows and columns of the board.

输出格式

For each testcase, print two integers — the row and the column of any isolated cell on the board. If there are no such cells, print any cell on the board.

输入输出样例

输入 #1
3
1 7
8 8
3 3
输出 #1
1 7
7 2
2 2
C++ 编辑器
输入
输出