#include <fstream>
#include <vector>
using namespace std;
ifstream f ("consecutive.in");
ofstream g ("consecutive.out");
long long n, T;
vector <pair <long long, long long> > sol;
void solve () {
f >> n;
sol.clear ();
for (int a = 2; a * a <= 2 * n; ++a) {
long long x = (2 * n / a + a - 1) / 2;
long long y = x - a;
if (x < 1 || y < 0) {
continue;
}
if (x * (x + 1) - y * (y + 1) == 2 * n) {
sol.push_back (make_pair (y + 1, x));
}
}
g << sol.size() << '\n';
for (int i = 0; i < sol.size(); ++i) {
g << sol[i].first << " " << sol[i].second << '\n';
}
}
int main() {
f >> T;
while (T--) {
solve ();
}
return 0;
}