#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <vector>
#include <deque>
#include <algorithm>
#include <list>
using namespace std;
#define STDIN_FILE_OPEN(FileName) {freopen(FileName, "r", stdin);}
#define STDOUT_FILE_OPEN(FileName) {freopen(FileName, "w", stdout);}
typedef long long int int64;
static int64 gArr[70000][2];
int main()
{
STDIN_FILE_OPEN("consecutive.in");
STDOUT_FILE_OPEN("consecutive.out")
int t, tests;
scanf("%d", &tests);
for (t = 0; t < tests; t++)
{
int64 S;
int i;
int idx = 0;
list<pair<int64, int64>> arr;
scanf("%lld", &S);
for (i = 2; ; i++)
{
int64 top = 2 * S - i*i - i;
if (top < 0)
break;
int64 bot = 2 * i;
if (top % bot == 0)
{
int64 m = top / bot;
int64 n = m + i;
m++;
gArr[idx][0] = m;
gArr[idx++][1] = n;
}
}
printf("%d\n", idx);
for (i = 0; i < idx; i++)
{
printf("%lld %lld\n", gArr[i][0], gArr[i][1]);
}
}
return 0;
}