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.
# WHERE: https://codeforces.com/problemset/page/8?order=BY_RATING_ASC
# AND https://codeforces.com/problemset/page/9?order=BY_RATING_ASC

# Taxi
# https://codeforces.com/problemset/problem/158/B
# Input
# The first line contains integer n (1 ≤ n ≤ 105) — the number of groups of schoolchildren. The second line contains a sequence of integers s1, s2, ..., sn (1 ≤ si ≤ 4). The integers are separated by a space, si is the number of children in the i-th group.
# Output
# Print the single number — the minimum number of taxis necessary to drive all children to Polycarpus.
# ignoreInput = input()
# groups = list(map(int, input().split()))
# i = 0
# j = len(groups) - 1  # last position of the array
# counter = 0

# counters = [0, 0, 0, 0]

# for group in groups:
#     counters[(group-1)] += 1

# fours = counters[3]
# threes = counters[2]
# ones = 0
# if counters[0] > threes:
#     ones = counters[0] - threes
# twos = (counters[1]//2) + (((counters[1] % 2)*2+ones)//4)
# # left = 0
# if (((counters[1] % 2)*2+ones) % 4) != 0:
#     twos += 1

# print(fours+threes+twos)
# ---------------------------------------------------------------------------------------------------------------------

# Fancy Fence
# https://codeforces.com/problemset/problem/270/A
# Input
# The first line of input contains an integer t (0 < t < 180) — the number of tests. Each of the following t lines contains a single integer a (0 < a < 180) — the angle the robot can make corners at measured in degrees.
# Output
# For each test, output on a single line "YES" (without quotes), if the robot can build a fence Emuskald wants, and "NO" (without quotes), if it is impossible.

# times = int(input())
# answers = []
# for time in range(times):
#     a = int(input())
#     if 360 % (180 - a) == 0:
#         answers.append("YES")
#     else:
#         answers.append("NO")
# for answer in answers:
#     print(answer)
# ---------------------------------------------------------------------------------------------------------------------

# Interesting drink
# https://codeforces.com/problemset/problem/706/B
# Input
# The first line of the input contains a single integer n (1 ≤ n ≤ 100 000) — the number of shops in the city that sell Vasiliy's favourite drink.
# The second line contains n integers xi (1 ≤ xi ≤ 100 000) — prices of the bottles of the drink in the i-th shop.
# The third line contains a single integer q (1 ≤ q ≤ 100 000) — the number of days Vasiliy plans to buy the drink.
# Then follow q lines each containing one integer mi (1 ≤ mi ≤ 109) — the number of coins Vasiliy can spent on the i-th day.
# Output
# Print q integers. The i-th of them should be equal to the number of shops where Vasiliy will be able to buy a bottle of the drink on the i-th day.
# def binarySearch(array, target, carry):
#     index = len(array)
#     if len(array) == 0:
#         return carry
#     if index == 1:
#         if target < array[0]:
#             return carry
#         else:
#             return carry + 1
#     # position in the middle
#     index = index//2
#     if target < array[index]:
#         # return the left
#         newPrices = array[0:index]
#         return binarySearch(newPrices, target, carry)
#     else:
#         # return the right
#         carry += (index)
#         newPrices = array[index:]
#         return binarySearch(newPrices, target, carry)

# nShops = int(input())
# shopPrices = list(map(int, input().split()))
# shopPrices.sort()
# times = int(input())
# answers = []

# def iterativeBinary(array, target):
#     low = 0
#     high = len(array) - 1
#     while (low <= high):
#         mid = low + ((high-low)//2)
#         print(mid)
#         if array[mid] > target:
#             high = mid - 1
#         else:
#             low = mid + 1
#     return low

# for time in range(times):
#     money = int(input())
#     # looks like the way i implemented the binary search isnt logN :(
#     # buys = binarySearch(shopPrices, money, 0)
#     buys = iterativeBinary(shopPrices, money)
#     answers.append(buys)
# for answer in answers:
#     print(answer)
# ---------------------------------------------------------------------------------------------------------------------

# A and B and Compilation Errors
# https://codeforces.com/problemset/problem/519/B
# Output
# Print two numbers on a single line: the numbers of the compilation errors that disappeared after B made the first and the second correction, respectively.

# compilationTimes = int(input())
# errors1 = list(map(int, input().split()))
# errors2 = list(map(int, input().split()))
# errors3 = list(map(int, input().split()))

# errors1.sort()
# errors2.sort()
# errors3.sort()

# n = -1
# isNFound = False
# m = 1
# isMFound = False
# for time in range(compilationTimes):
#     if isNFound and isMFound:
#         break
#     if not isNFound:
#         if time < len(errors2):
#             if errors1[time] != errors2[time]:
#                 n = errors1[time]
#                 isNFound = True
#         else:
#             n = errors1[time]
#             isNFound = True

#     if not isMFound:
#         if time < len(errors3):
#             if errors2[time] != errors3[time]:
#                 m = errors2[time]
#                 isMFound = True
#         else:
#             m = errors2[time]
#             isNFound = True


# print(n)
# print(m)
# ---------------------------------------------------------------------------------------------------------------------

# Double Cola
# https://codeforces.com/problemset/problem/82/A
# Input
# The input data consist of a single integer n (1 ≤ n ≤ 109).
# It is guaranteed that the pretests check the spelling of all the five names, that is, that they contain all the five possible answers.
# Output
# Print the single line — the name of the person who drinks the n-th can of cola. The cans are numbered starting from 1. Please note that you should spell the names like this: "Sheldon", "Leonard", "Penny", "Rajesh", "Howard" (without the quotes). In that order precisely the friends are in the queue initially.
# target = int(input())
# people = ["Sheldon", "Leonard", "Penny", "Rajesh", "Howard"]
# target -= 1
# k = 0
# while True:
#     if 5 * (2**k - 1) > target:
#         break
#     k += 1
# k -= 1
# corrimiento = target - (5 * (2**k - 1))
# realK = 2**(k)
# positionArray = (corrimiento)//realK
# print(people[positionArray])
# ---------------------------------------------------------------------------------------------------------------------

# stringToCheck = input()
# times = int(input())
# answers = []
# for time in range(times):
#     query = list(map(int, input().split()))
#     subArray = stringToCheck[query[0]-1:(query[1])]
#     i = 0
#     answer = 0
#     while i < (len(subArray)-1):
#         if subArray[i] == subArray[i+1]:
#             answer += 1
#         i += 1
#     answers.append(answer)
# for ans in answers:
#     print(ans)
# ---------------------------------------------------------------------------------------------------------------------

# Two Teams Composing
# https://codeforces.com/problemset/problem/1335/C
# testCases = int(input())
# answers = []
# for testCase in range(testCases):
#     ignoreInput = input()
#     teammates = input().split()
#     teammates.sort(reverse=True)
#     powers = {}
#     maxTarget = len(teammates)//2

#     for mate in teammates:
#         if mate in powers:
#             powers[mate] += 1
#         else:
#             powers[mate] = 1

#     powersLen = len(powers)

#     new_powers = sorted(powers.items(), key=lambda x: x[1], reverse=True)
#     if len(teammates) == 1:
#         answers.append(maxTarget)
#     else:
#         for i in range(maxTarget):
#             if powersLen == maxTarget:
#                 isValid = False
#                 for power, count in new_powers:
#                     if count > maxTarget:
#                         isValid = True
#                         break
#                     else:
#                         break
#                 if isValid:
#                     answers.append(maxTarget)
#                     break
#                 maxTarget -= 1
#             elif powersLen > maxTarget:
#                 isValid = False
#                 for power, count in new_powers:
#                     if count >= maxTarget:
#                         isValid = True
#                         break
#                     else:
#                         break
#                 if isValid:
#                     answers.append(maxTarget)
#                     break
#                 maxTarget -= 1
#             else:
#                 maxTarget -= 1
# for answer in answers:
#     print(answer)
# ---------------------------------------------------------------------------------------------------------------------

# Sum of Odd Integers
# https://codeforces.com/problemset/problem/1327/A

# 256 78


def isPossibleImproved(maxOdd, target):
    newTarget = (target - maxOdd)/2
    maxOdd -= 1
    sumatoriaHastaN = (maxOdd * (maxOdd+1))//2
    if sumatoriaHastaN > newTarget:
        return False
    return True


def isPossible(maxOdd, target):
    if maxOdd % 2 == 0:
        maxOdd -= 1
    sumatoriaOdds = ((maxOdd+1)/2)**2
    if target < sumatoriaOdds:
        return False
    return True


for i in range(int(input())):
    n, k = map(int, input().split())
    print('YES' if k * k <= n and n % 2 == k % 2 else 'NO')
# ---------------------------------------------------------------------------------------------------------------------
