import java.util.Scanner;
public class P1003 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt(), arr[] = new int[n];
for (int i = 0; i < n; i++) {
arr[i] = sc.nextInt();
}
for (int ele : arr) {
System.out.println(zeroDp(ele) + " " + oneDp(ele));
}
sc.close();
}
private static int zeroDp(int n) {
if (n == 0)
return 1;
if (n == 1) {
return 0;
}
int[] dp = new int[n + 1];
dp[0] = 1;
dp[1] = 0;
for (int i = 2; i < dp.length; i++) {
dp[i] = dp[i - 1] + dp[i - 2];
}
return dp[n];
}
private static int oneDp(int n) {
if (n == 0)
return 0;
if (n == 1) {
return 1;
}
int[] dp = new int[n + 1];
dp[0] = 0;
dp[1] = 1;
for (int i = 2; i < dp.length; i++) {
dp[i] = dp[i - 1] + dp[i - 2];
}
return dp[n];
}
}