Chef wants to select a subset $S$ of the set $\{1, 2, \ldots, N\}$ such that there are no two integers $x, y \in S$ which satisfy $\frac{x}{y} = M$.
Help Chef find the maximum size of a subset $S$ he can choose and the number of ways in which he can choose a subset $S$ with this maximum size. Since the number of ways to choose $S$ can be very large, calculate it modulo $998,244,353$.

-----Input-----
- The first line of the input contains a single integer $T$ denoting the number of test cases. The description of $T$ test cases follows.
- The first and only line of each test case contains two space-separated integers $N$ and $M$.

-----Output-----
For each test case, print a single line containing two space-separated integers ― the maximum size of a subset Chef can choose and the number of ways to choose a subset with this maximum size modulo $998,244,353$. Note that only the number of ways to choose a subset should be printed modulo $998,244,353$.

-----Constraints-----
- $1 \le T \le 10,000$
- $2 \le M \le N \le 10^{18}$

-----Example Input-----
3
5 2
10 2
100 3

-----Example Output-----
4 1
6 12
76 49152

-----Explanation-----
Example case 1: The only subset $S$ with the maximum size which Chef can choose is $\{1, 3, 4, 5\}$.

```python

USER_FILENAME = "<user_code>"
import sys, json, builtins
import math, heapq, bisect, itertools, functools, collections, statistics, fractions, decimal, operator, array, random, re, string, os, pathlib
try:
    import resource as _res
except Exception:
    _res = None
from collections import Counter, defaultdict, deque, OrderedDict
from functools import lru_cache, reduce
from itertools import accumulate, permutations, combinations, product
from math import gcd, ceil, floor, sqrt
from decimal import Decimal
try:
    from typing import *
except Exception:
    pass
try:
    sys.setrecursionlimit(1_000_000)
except Exception:
    pass
try:
    import site as _site
    try:
        _sys_sites = _site.getsitepackages() if hasattr(_site, "getsitepackages") else []
        for _p in _sys_sites:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
    try:
        _usp = _site.getusersitepackages()
        if isinstance(_usp, str):
            _usp = [_usp]
        for _p in _usp:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
except Exception:
    pass

ns = {"__name__": "__main__"}
for _k, _v in list(globals().items()):
    if not _k.startswith("_"):
        ns[_k] = _v
_CODE = 'def groupsInInterval(L,R,M,N):\n if(R<=N):\n  return (R - (L-1)) -(R//M - (L-1)//M)\n else:\n  return 0\ndef power(a,b):\n # print(a,\'**\',b, a**b)\n MOD = 998244353\n res = 1\n while(b>0):\n  # print(\'a = \', a,"b = ",b)\n\n  if(b%2):\n   res*=a\n   res%=MOD\n  b//=2\n  a*=a\n  a%=MOD\n # print(\'res\',res)\n return res\n\nwhile(True):\n try:\n  test = int(input())\n except EOFError:\n  break\n for i in range (test):\n  MOD = 998244353\n  n,m = list(map(int,input().split()))\n  taken,ways = 0,1\n  for i in range(1,70):\n   # print(ways)\n   L = n//m**i + 1;\n   R = n//m**(i-1)\n   groups = groupsInInterval(L,R,m,n)\n   if(i%2==0):\n    taken+= (i//2 )*groups\n    # print("ways ",ways)\n    ways*= power((i//2 +1),groups)\n    # ways*= ((i//2 +1)**groups)\n   else:\n    taken+= ((i+1)//2)*groups\n    ways *= (1)\n  print(taken,ways%MOD)\n'
_co = compile(_CODE, USER_FILENAME, "exec")
exec(_co, ns, ns)

```

Measured memory_bytes: 14189