Alice and Bob play a game. There is a paper strip which is divided into n + 1 cells numbered from left to right starting from 0. There is a chip placed in the n-th cell (the last one).

Players take turns, Alice is first. Each player during his or her turn has to move the chip 1, 2 or k cells to the left (so, if the chip is currently in the cell i, the player can move it into cell i - 1, i - 2 or i - k). The chip should not leave the borders of the paper strip: it is impossible, for example, to move it k cells to the left if the current cell has number i < k. The player who can't make a move loses the game.

Who wins if both participants play optimally?

Alice and Bob would like to play several games, so you should determine the winner in each game.


-----Input-----

The first line contains the single integer T (1 ≤ T ≤ 100) — the number of games. Next T lines contain one game per line. All games are independent.

Each of the next T lines contains two integers n and k (0 ≤ n ≤ 10^9, 3 ≤ k ≤ 10^9) — the length of the strip and the constant denoting the third move, respectively.


-----Output-----

For each game, print Alice if Alice wins this game and Bob otherwise.


-----Example-----
Input
4
0 3
3 3
3 4
4 4

Output
Bob
Alice
Bob
Alice

Difficulty: interview

Starter code:

Solutions:
import sys

T = int(sys.stdin.readline().strip())
for t in range(0, T):
    n, k = list(map(int, sys.stdin.readline().strip().split()))
    if k % 3 != 0:
        if n % 3 == 0:
            print("Bob")
        else:
            print("Alice")
    else:
        n = n % (k + 1)
        if n == k:
            print("Alice")
        elif n % 3 == 0:
            print("Bob")
        else:
            print("Alice")

q = int(input())
for query in range(q):
	n, k = map(int,input().split())
	if k % 3 != 0:
		if n % 3 == 0:
			print("Bob")
		else:
			print("Alice")
	else:
		n = n % (k + 1)
		if n == k:
			print("Alice")
		else:
			if n % 3 == 0:
				print("Bob")
			else:
				print("Alice")

def Game(n, k):
    if k % 3 != 0:
        return [1, 0, 0][n % 3]
    else:
        n %= (k+4)
        if n == k+3:
            return 0
        else:
            return [1, 0, 0][n % 3]


for i in range(int(input())):
    N, K = list(map(int, input().split()))
    print(['Alice', 'Bob'][Game(N, K-3)])


t = int(input())

def solve(n,k):
    if k%3 != 0:
        return n%3
    else:
        if n%(k+1) == k:
            return 3
        else:
            return n%(k+1)%3

for _ in range(t):
    n,k = list(map(int,input().split()))
    if solve(n,k):
        print('Alice')
    else:
        print('Bob')


import sys
Q = int(input())
def check(N, k):
    if k % 3:
        return (N % 3 == 0)
    if N%(k+1) == k:
        return False
    return ((N%(k+1)) % 3 == 0)

for _ in range(Q):
    N, k = list(map(int, sys.stdin.readline().split()))
    if check(N, k):
        print('Bob')
    else:
        print('Alice')


import sys
input = sys.stdin.readline
from collections import Counter

Q=int(input())
for testcases in range(Q):
    n,k=list(map(int,input().split()))

    if k%3!=0:
        if n%3==0:
            print("Bob")
        else:
            print("Alice")

    else:
        l=n%(k+1)

        if l==k:
            print("Alice")
        elif l%3==0:
            print("Bob")
        else:
            print("Alice")


w = int(input())
for i in range(w):
    a,b=list(map(int, input().split()))
    a+=1
    if(b%3!=0):
        if(a%3==1):
            print("Bob")
        else:
            print("Alice")
    else:
        if((a%(b+1))%3==1):
            print("Bob")
        else:
            print("Alice")


def gns():
    return list(map(int,input().split()))
t=int(input())


def one():
    n,k=gns()
    if k%3!=0:
        if n%3==0:
            print('Bob')
        else:
            print('Alice')
        return
    if n%(k+1)==k:
        print('Alice')
        return
    n=n%(k+1)
    if n%3==0:
        print('Bob')
    else:
        print('Alice')



for i in range(t):
    one()






q=int(input())
for i in range(q):
    ints=[int(x) for x in input().split()]
    n=ints[0]
    k=ints[1]
    if k % 3 == 0:
        if (n % (k+1)) % 3 != 0 or (n % (k+1)) == k:
            print("Alice")
        else:
            print("Bob")
    else:
        if n % 3 == 0:
            print("Bob")
        else:
            print("Alice")

T = int(input())
for _ in range(T):
    n, k = map(int, input().split())
    if k % 3:
        if n % 3:
            print("Alice")
        else:
            print("Bob")
    else:
        loop = k+1
        idx = n % loop
        if idx == k:
            print("Alice")
        elif idx % 3:
            print("Alice")
        else:
            print("Bob")

    '''
    sg = [0] * (n+3)
    sg[1] = 1
    sg[2] = 1
    for i in range(3, n+1):
        if sg[i-1] == 0:
            sg[i] = 1
        elif sg[i-2] == 0:
            sg[i] = 1
        elif i >= k and sg[i-k] == 0:
            sg[i] = 1
        else:
            sg[i] = 0
    if sg[n]:
        print("Alice")
    else:
        print("Bob")
    print(sg)
    '''

T = int(input())
for i in range(T):
    n, k = list(map(int, input().split()))
    if k % 3 != 0:
        if n % 3 == 0:
            print("Bob")
        else:
            print("Alice")
    else:
        quotient = k + 1
        remainder = n % quotient
        if remainder % 3 == 0 and remainder != k:
            print("Bob")
        else:
            print("Alice")


from sys import stdin
c=int(stdin.readline().strip())
for i in range(c):
    n,m=list(map(int,stdin.readline().strip().split()))
    if n==0:
        print("Bob")
        continue

    if m%3==0:
        n=n%(m+1)
        if (n==0 or n%3==0) and  n!=m:
            print("Bob")
        else:
            print("Alice")
        continue
    if n%3==0:
        print("Bob")
    else:
        print("Alice")
"""
k=6
dp=["B","A","A"]
for i in range(3,30):
    n=len(dp)
    if n-k>=0:
        if dp[n-1]=="B" or dp[n-2]=="B" or dp[n-k]=="B":
            dp.append("A")
            continue
        else:
            dp.append("B")
            continue
    else:
        if dp[n-1]=="B" or dp[n-2]=="B":
            dp.append("A")
            continue
        else:
            dp.append("B")
            continue  
        
"""


import sys
import math
#input = sys.stdin.readline

t=int(input())

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

	if k%3!=0:
		if n%3==0:
			print("Bob")
		else:
			print("Alice")
	else:
		n+=1
		n=n%(k+1)
		if n%3==1:
			print("Bob")
		else:
			print("Alice")

def find(n,k):
    if k%3!=0:
        if n%3==0:
            return "Bob"
        else:
            return "Alice"
    position=n%(k+1)
    if position==k:
        return "Alice"
    if position%3==0:
        return "Bob"
    else:
        return "Alice"

ans=[]
for _ in range(int(input())):
    n,k=list(map(int,input().strip().split(' ')))
    ans+=[find(n,k)]
print("\n".join(ans))



t=int(input())
for x in range(t):
    n,k=list(map(int,input().split()))
    if (k%3)!=0:
        n=n+1
        if(n%3==1):
            print("Bob")
        else:
            print("Alice")
    else:
        
        
        m=(n+1)%(4+3*(k//3-1))
        if(m==0):
            print("Alice")
        else:
            if(m<=(3*(k//3-1))):
                r=m%3
                if(r==1):
                    print("Bob")
                else:
                    print("Alice")
            elif(m==(1+3*(k//3-1))):
                print("Bob")
            else:
                print("Alice")
            



t = int(input())
for _ in range(t):
    n,k = list(map(int, input().split()))
    if k!=0 and k%3 == 0:
        extras = (n+1)//(k+1)
        n = n-extras
    if n%3 == 0:
        print("Bob")
    else:
        print("Alice")


T = int(input())
for _ in range(T):
    n, k = list(map(int, input().split()))
    if k == 3:
        print("Bob" if n % 4 == 0 else "Alice")
    elif k % 3:
        print("Bob" if n % 3 == 0 else "Alice")
    else:
        d = (n // k) % 3
        print("Bob" if n % (k+1) < k and n % (k+1) % 3 == 0 else "Alice")


t = int(input())
for i in range(t):
    n,k = list(map(int,input().split()))
    if k % 3 != 0 or k > n:
        print('Bob' if n % 3 == 0 else 'Alice')
    else:
        print('Bob' if (n % (k + 1)) % 3 == 0 and (n % (k + 1)) != k else 'Alice')


from sys import stdin

T = int(stdin.readline())
for _ in range(T):
    n, k = [int(x) for x in stdin.readline().split()]
    if k % 3 == 1:
        w = k + 2
    else:
        w = k + 1
    # print('w', w)
    n_mod_w = n % w
    # print('n_mod_w', n_mod_w)
    if n_mod_w % 3 in {1, 2} or n_mod_w == k:
        print('Alice')
    else:
        print('Bob')


q=int(input())
for _ in range(q):
  n,k=map(int,input().split())
  if n==0:
    print('Bob')
  elif n==1 or n==2:
    print('Alice')
  else:
    if n==k:
      print('Alice')
    else:
      if k==1 or k==2 or k>n:
        if n%3==0:
          print('Bob')
        else:
          print('Alice')
      else:
        if k%3!=0:
          if n%3==0:
            print('Bob')
          else:
            print('Alice')
        else:
          m=n%(k+1)
          if m%3==0 and m!=k:
            print('Bob')
          else:
            print('Alice')

l=int(input())
osy=0
for i in range(l):
    n,k=list(map(int,input().split()))
    if n<k:
        osy=n%3
        if osy==0:
            print("Bob")
        else:
            print("Alice")
    else:
        prom=k-1
        if prom%3==2:
            if n%(k+1)==k:
                print("Alice")
            
            elif ((n-k)%(k+1))%3==1:
                print("Bob")
            else:
                print("Alice")
        else:
            osy=n%3
            if osy==0:
                print("Bob")
            else:
                print("Alice")