#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
void cinArray(int len, ll arr[]) {
for (int i = 0; i < len; i++)
{
cin >> arr[i];
}
}
bool check(string s,int n) {
int count = 0;
for (int i = 0; i < s.length(); i++) {
if (s[i] == '_')
count++;
if (count > n-1)
return false;
}
if (count < n-1)
return false;
else
return true;
}
int main() {
int t;
cin >> t;
while (t--) {
ll n, k;
cin >> n >> k;
ll c = k, count = 1;
if (k >= 2) {
while (n > c) {
c += k;
count++;
}
if (count % 2 != 0)
{
cout << "YES" << endl;
}
else {
if (k % 2 == 0)
cout << "NO" << endl;
else {
int a = (int) floor(k / 2);
if (c - a == n)
cout << "YES" << endl;
else
cout << "NO" << endl;
}
}
}
else
{
cout << "YES" << endl;
}
}
}