#include <bits/stdc++.h>
int main() {
  int num;
  scanf("%d", &num);
  for (int i = 0; i < num; i++) {
    long long n, k;
    scanf("%lld %lld", &n, &k);
    n += k;
    if (n % 2) {
      printf("No\n");
      continue;
    }
    n /= 2;
    if (n >= (k * (k + 1)) / 2)
      printf("Yes\n");
    else
      printf("No\n");
  }
  return 0;
}
