#include<iostream>
#include<utility>
using namespace std;
int arr[41][2] = { 0, };
pair<int,int> search(int num){
if(arr[num][0] + arr[num][1]){
return make_pair(arr[num][0], arr[num][1]);
}
pair<int,int> tmp1 = search(num-1);
pair<int,int> tmp2 = search(num-2);
arr[num][0] = tmp1.first + tmp2.first;
arr[num][1] = tmp1.second + tmp2.second;
return make_pair(arr[num][0], arr[num][1]);
}
int main(){
arr[0][0] = arr[1][1] = 1;
int T;
cin>>T;
while(T--){
int n;
cin>> n;
search(n);
printf("%d %d\n", arr[n][0],arr[n][1]);
}
}