You are given two integers n and k. Your task is to find if n can be represented as a sum of k distinct positive odd (not divisible by 2) integers or not.

You have to answer t independent test cases.

Input

The first line of the input contains one integer t (1 ≤ t ≤ 10^5) — the number of test cases.

The next t lines describe test cases. The only line of the test case contains two integers n and k (1 ≤ n, k ≤ 10^7).

Output

For each test case, print the answer — "YES" (without quotes) if n can be represented as a sum of k distinct positive odd (not divisible by 2) integers and "NO" otherwise.

Example

Input


6
3 1
4 2
10 3
10 2
16 4
16 5


Output


YES
YES
NO
YES
YES
NO

Note

In the first test case, you can represent 3 as 3.

In the second test case, the only way to represent 4 is 1+3.

In the third test case, you cannot represent 10 as the sum of three distinct positive odd integers.

In the fourth test case, you can represent 10 as 3+7, for example.

In the fifth test case, you can represent 16 as 1+3+5+7.

In the sixth test case, you cannot represent 16 as the sum of five distinct positive odd integers.
from sys import stdin
from collections import deque
mod = 10**9 + 7
import sys
import random
# sys.setrecursionlimit(10**6)
from queue import PriorityQueue
# def rl():
#     return [int(w) for w in stdin.readline().split()]
from bisect import bisect_right
from bisect import bisect_left
from collections import defaultdict
from math import sqrt,factorial,gcd,log2,inf,ceil
# map(int,input().split())
# # l = list(map(int,input().split()))
# from itertools import permutations
import heapq
# input = lambda: sys.stdin.readline().rstrip()
input = lambda : sys.stdin.readline().rstrip()
from sys import stdin, stdout
from heapq import heapify, heappush, heappop
from itertools import permutations
from math import factorial as f

# def ncr(x, y):
#     return f(x) // (f(y) * f(x - y))
def ncr(n, r, p):
    num = den = 1
    for i in range(r):
        num = (num * (n - i)) % p
        den = (den * (i + 1)) % p
    return (num * pow(den,
                      p - 2, p)) % p
from collections import defaultdict
from heapq import heappop, heappush, heapify




# n = int(input())
#
# l1 = list(map(int,input().split()))
#
# l2 = list(map(int,input().split()))
#
# cnt1 = 0
# cnt2 = 0
#
# for i in range(n):
#     if l1[i]>l2[i]:
#         cnt1+=1
#     elif l1[i]<l2[i]:
#         cnt2+=1
# if cnt1>cnt2:
#     print(1)
# elif cnt2>cnt1 and cnt1!=0:
#     z = 1 + ceil((cnt2-cnt1)/cnt1)
#     # print(cnt1,cnt2)
#     if z*cnt1>cnt2:
#         print(z)
#     else:
#         print(z+1)
#
# else:
#     print(-1)

# t = int(input())
#
# for _ in range(t):
#
#     n,k = map(int,input().split())


# t = int(input())
#
# for _ in range(t):
#
#     hash=  defaultdict(list)
#     n = int(input())
#     hash1 = defaultdict(set)
#     for i in range(1,n+1):
#         hash[i] = list(map(int,input().split()))[1:]
#         hash1[i] = set(hash[i])
#
#     ma = defaultdict(bool)
#     pos = []
#     for i in range(1,n+1):
#         flag = 0
#
#         for j in hash[i]:
#
#             if ma[j] == False:
#                 # if i == 1:
#                 #     print(j)
#                 ma[j] = True
#                 flag = 1
#                 break
#
#         if not flag:
#             pos.append(i)
#
#     ka = set()
#
#     for i in range(1,n+1):
#         if ma[i] == False:
#             ka.add(i)
#
#     ans1,ans2 = -1,-1
#
#     for i in pos:
#         s = ka - hash1[i]
#         if s!=set():
#             ans1 = i
#             ans2 = s.pop()
#             break
#
#     if ans1!=-1:
#         print('IMPROVE')
#         print(ans1,ans2)
#     else:
#         print('OPTIMAL')
#
#
#
#
#


# n,m,k = map(int,input().split())

t = int(input())

for _ in range(t):

    a,b = map(int,input().split())
    z = b*(2*1 + ((b-1)*2))
    z//=2

    if b%2 == a%2 :
        if z<=a:
            print('YES')
        else:
            print('NO')
    else:
        print('NO')


