Codechef•Aug 03, 2025
Tom and Jerry Chase
Hazrat Ali
Codechef
Jerry is running at a speed of X metres per second while Tom is chasing him at a speed of Y metres per second. Determine whether Tom will be able to catch Jerry.
Note that initially Jerry is not at the same position as Tom.
Input Format
- The first line of input will contain a single integer T, denoting the number of test cases.
- Each test case consists of two space-separated integers X and Y — the speeds of Jerry and Tom respectively.
Output Format
For each test case, output on a new line, YES
, if Tom will be able to catch Jerry. Otherwise, output NO
.
You can print each character in uppercase or lowercase. For example NO
, no
, No
, and nO
are all considered the same.
Constraints
- 1≤T≤100
- 1≤X,Y≤10
Sample 1:
Input
4 2 3 4 1 1 1 3 5
Output
YES NO NO YES
Solution
T = int(input())
for _ in range(T):
X, Y = map(int, input().split())
if Y > X:
print("YES")
else:
print("NO")