Q=int(input()) for _ in range(Q): N,M=map(int,input().split()) if N%2==1: N-=1 if M%2==1: M-=1 if 2*N=6: result+=3 print(result)