 Hello Programmers In this post, you will know how to solve the Ada School Codechef Solution. The Problem Code: ADASCOOL

One more thing to add, don’t directly look for the solutions, first try to solve the problems of Codechef by yourself. If you find any difficulty after trying several times, then you can look for solutions.

### Problem

Ada’s classroom contains N⋅MN⋅M tables distributed in a grid with NN rows and MM columns. Each table is occupied by exactly one student.

Before starting the class, the teacher decided to shuffle the students a bit. After the shuffling, each table should be occupied by exactly one student again. In addition, each student should occupy a table that is adjacent to that student’s original table, i.e. immediately to the left, right, top or bottom of that table.

Is it possible for the students to shuffle while satisfying all conditions of the teacher?

### Input

• The first line of the input contains a single integer TT denoting the number of test cases. The description of TT test cases follows.
• The first and only line of each test case contains two space-separated integers NN and MM.

### Output

For each test case, print a single line containing the string `"YES"` if it is possible to satisfy the conditions of the teacher or `"NO"` otherwise (without quotes).

### Constraints

• 1≤T≤5,0001≤T≤5,000
• 2≤N,M≤502≤N,M≤50

### Sample Input 1

``````2
3 3
4 4``````

### Sample Output 1

``````NO
YES``````

### Explanation

Example case 2: The arrows in the following image depict how the students moved.

### Ada School CodeChef Solution in JAVA

```import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int T = sc.nextInt();
for (int tc = 0; tc < T; tc++) {
int N = sc.nextInt();
int M = sc.nextInt();
System.out.println(solve(N, M) ? "YES" : "NO");
}
sc.close();
}
static boolean solve(int N, int M) {
return N % 2 == 0 || M % 2 == 0;
}
}```

Disclaimer: The above Problem (Ada School) is generated by CodeChef but the solution is provided by BrokenProgrammers. This tutorial is only for Educational and Learning purpose.

Note:- I compile all programs, if there is any case program is not working and showing an error please let me know in the comment section. If you are using adblocker, please disable adblocker because some functions of the site may not work correctly.