#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>

#define NMAX 31663

int main() {
	int ntestes, teste;
	int n, m;
	int nd;
	int maior, numero;
	int i, j;
	int raiz;

	scanf("%d", &ntestes);
	for (teste=0; teste<ntestes; teste++) {
		scanf("%d %d", &n, &m);
		maior=0;
		for (i=n; i<=m; i++) {
			nd=0;
			raiz=sqrt(i);
			if (raiz*raiz==i) {
				nd++;
			} else {
				raiz++;
			}
			for (j=1; j<raiz; j++) {
				if (!(i%j)) {
					nd+=2;
				}
			}
			if (nd>maior) {
				maior=nd;
				numero=i;
			}
		}
		printf("Between %d and %d, %d has a maximum of %d divisors.\n", n, m, numero, maior);
	}


	return 0;
}

