import java.util.Scanner;
public class Test {
public static void main(String args[]) {
int ri, repeat;
int i, m, n;
long f;
Scanner in = new Scanner(System.in);
repeat = in.nextInt();
for (ri = 1; ri <= repeat; ri++) {
m = in.nextInt();
n = in.nextInt();
for (int j = 1;; j++) {
int fibJ=fib(j);
if (fibJ>n) {
break;
}
if (fibJ>=m) {
System.out.println(fibJ);
}
}
System.out.println();
}
}
public static int fib(int n) {
if (n==1||n==2) {
return 1;
}else {
return fib(n-1)+fib(n-2);
}
}
}
m mmm,
2