for _ in range(int(input())): X, Y = map(int, input().split()) while 1<