#include <iostream>
#include <cmath>

using namespace std;

pair<int, int> fun(long long k) {
    // Direct calculation of n using quadratic formula
    int n = ceil((-1.0 + sqrt(1 + 8.0 * k)) / 2.0);  

    // Sum of elements before the nth row
    long long count = (n * (n - 1)) / 2;
    
    // Find m
    int m = k - count - 1;

    return {m, n};
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    int T;
    cin >> T;
    
    while (T--) {
        long long k;
        cin >> k;
        
        pair<int, int> result = fun(k);
        cout << result.first << " " << result.second << "\n";
    }
    
    return 0;
}
