// Cheese-Cracker: cheese-cracker.github.io

void theCode(){
    ll k = scan;
    k -= 1;
    ll rt = to!ll(floor(sqrt(to!double(k))));
    if((rt + 1) *(rt + 1) <= k){
        rt += 1;
    }
    ll lef = k - rt*rt;
    ll d = min(rt, lef);
    ll b = max(0, lef - rt);
    ll x = (rt+1) - b;
    ll y = d + 1;
    writeln(y, " ", x);
}

void main(){
    long tests = scan;        // Toggle!
    while(tests--) theCode();
}

/*********  That's All Folks!  *********/
import std.stdio, std.random, std.functional, std.container, std.algorithm;
import std.numeric, std.range, std.typecons, std.string, std.math, std.conv;
string[] tk; T scan(T=long)(){while(!tk.length)tk = readln.split; string a=tk.front; tk.popFront; return a.to!T;}
T[] scanArray(T=long)(){ auto r = readln.split.to!(T[]); return r; }
void show(A...)(A a){ debug{ foreach(t; a){stderr.write(t, "| ");} stderr.writeln; } }
alias ll = long, tup = Tuple!(long, "x",  long, "y");
