#include <iostream>
using namespace std;
long long int FN[49];
void printout(long long int n, long long int st, long long int ed);
int main() {
FN[0] = 1;
FN[1] = 1;
for(int i = 2;i < 49;i++)
FN[i] = FN[i - 2] + FN[i - 1];
int m;
cin >> m;
for(int i = 0;i < m;i++){
long long int n, st, ed;
cin >> n >> st >> ed;
if(n >= 48)
n = 48 - (n % 2);
printout(n, st, ed);
cout << endl;
}
return 0;
}
void printout(long long int n, long long int st, long long int ed){
if(n == 0 || n == 1)
cout << n;
else{
if(st < FN[n - 2] && ed < FN[n - 2]){
printout(n - 2, st, ed);
}else if(st < FN[n - 2] && FN[n - 2] <= ed){
printout(n - 2, st, FN[n - 2] - 1);
printout(n - 1, 0, ed - FN[n - 2]);
}else{//FN[n - 2] <= st && FN[n - 2] <= ed
printout(n - 1, st - FN[n - 2], ed - FN[n - 2]);
}
}
}
留言列表