program killer;
var
K, N, T, test : LongInt;
ans : AnsiString;
begin
{
uncomment the two following lines if you want to read/write from files
assign(input, 'input.txt'); reset(input);
assign(output, 'output.txt'); rewrite(output);
}
ReadLn(T);
for test:=1 to T do begin
ReadLn(N, K);
ans := '';
if (N=K*(K+1) div 2) or (N=K*(K+1) div 2 +1) or (K=1) then ans:='YES'
else ans:='NO';
WriteLn(ans);
end;
end.
cHJvZ3JhbSBraWxsZXI7CnZhcgogICAgSywgTiwgVCwgdGVzdCA6IExvbmdJbnQ7CiAgICBhbnMgICAgICAgICAgIDogQW5zaVN0cmluZzsKCmJlZ2luCnsKICAgIHVuY29tbWVudCB0aGUgdHdvIGZvbGxvd2luZyBsaW5lcyBpZiB5b3Ugd2FudCB0byByZWFkL3dyaXRlIGZyb20gZmlsZXMKICAgIGFzc2lnbihpbnB1dCwgICdpbnB1dC50eHQnKTsgIHJlc2V0KGlucHV0KTsKICAgIGFzc2lnbihvdXRwdXQsICdvdXRwdXQudHh0Jyk7IHJld3JpdGUob3V0cHV0KTsKfQoKICAgIFJlYWRMbihUKTsKICAgIGZvciB0ZXN0Oj0xIHRvIFQgZG8gYmVnaW4KICAgICAgICBSZWFkTG4oTiwgSyk7CgogICAgICAgIGFucyA6PSAnJzsKCiAgICAgICAgaWYgKE49SyooSysxKSBkaXYgMikgb3IgKE49SyooSysxKSBkaXYgMiArMSkgb3IgKEs9MSkgdGhlbiBhbnM6PSdZRVMnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSBhbnM6PSdOTyc7CgoKICAgICAgICBXcml0ZUxuKGFucyk7CiAgICBlbmQ7CgplbmQuCg==